From dc779ff0a33d9da8bc55390ee55ad73d31739e46 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Fri, 19 Apr 2024 16:12:42 +0200 Subject: Configure individual action colors using APT::Color::Action --- apt-private/private-install.cc | 2 +- apt-private/private-output.cc | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) (limited to 'apt-private') diff --git a/apt-private/private-install.cc b/apt-private/private-install.cc index 87793d973..774c03d0a 100644 --- a/apt-private/private-install.cc +++ b/apt-private/private-install.cc @@ -1104,7 +1104,7 @@ bool DoInstall(CommandLine &CmdL) if (_config->FindI("APT::Output-Version") < 30 && Cache->InstCount() != verset[MOD_INSTALL].size()) ShowList(c1out, _("The following additional packages will be installed:"), Universe, PkgIsExtraInstalled(&Cache, &verset[MOD_INSTALL]), - &PrettyFullName, CandidateVersion(&Cache), "green"); + &PrettyFullName, CandidateVersion(&Cache), "action::install-dependencies"); /* Print out a list of suggested and recommended packages */ if (_config->FindI("APT::Output-Version") < 30) diff --git a/apt-private/private-output.cc b/apt-private/private-output.cc index 380558964..c2e936d2c 100644 --- a/apt-private/private-output.cc +++ b/apt-private/private-output.cc @@ -105,6 +105,12 @@ bool InitOutput(std::basic_streambuf * const out) /*{{{*/ _config->CndSet("APT::Color::Magenta", "\x1B[35m"); _config->CndSet("APT::Color::Cyan", "\x1B[36m"); _config->CndSet("APT::Color::White", "\x1B[37m"); + + _config->CndSet("APT::Color::Action::Upgrade", "green"); + _config->CndSet("APT::Color::Action::Install", "green"); + _config->CndSet("APT::Color::Action::Install-Dependencies", "green"); + _config->CndSet("APT::Color::Action::Downgrade", "yellow"); + _config->CndSet("APT::Color::Action::Remove", "red"); } return true; @@ -557,7 +563,7 @@ void ShowNew(ostream &out,CacheFile &Cache) [&Cache](pkgCache::PkgIterator const &Pkg) { return Cache[Pkg].NewInstall(); }, &PrettyFullName, CandidateVersion(&Cache), - "green"); + "action::install"); return; } @@ -565,12 +571,12 @@ void ShowNew(ostream &out,CacheFile &Cache) [&Cache](pkgCache::PkgIterator const &Pkg) { return Cache[Pkg].NewInstall() && (Cache[Pkg].Flags & pkgCache::Flag::Auto) == 0; }, &PrettyFullName, CandidateVersion(&Cache), - "green"); + "action::install"); ShowList(out,_("Installing dependencies:"), Universe, [&Cache](pkgCache::PkgIterator const &Pkg) { return Cache[Pkg].NewInstall() && Cache[Pkg].Flags & pkgCache::Flag::Auto;}, &PrettyFullName, CandidateVersion(&Cache), - "green"); + "action::install-dependencies"); } /*}}}*/ // ShowDel - Show packages to delete /*{{{*/ @@ -588,7 +594,7 @@ void ShowDel(ostream &out,CacheFile &Cache) return str; }, CandidateVersion(&Cache), - "red"); + "action::remove"); } /*}}}*/ // ShowPhasing - Show packages kept due to phasing /*{{{*/ @@ -627,7 +633,7 @@ void ShowUpgraded(ostream &out,CacheFile &Cache) }, &PrettyFullName, CurrentToCandidateVersion(&Cache), - "green"); + "action::upgrade"); } /*}}}*/ // ShowDowngraded - Show downgraded packages /*{{{*/ @@ -644,7 +650,7 @@ bool ShowDowngraded(ostream &out,CacheFile &Cache) }, &PrettyFullName, CurrentToCandidateVersion(&Cache), - "yellow"); + "action::downgrade"); } /*}}}*/ // ShowHold - Show held but changed packages /*{{{*/ -- cgit v1.2.3-70-g09d2