summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2024-04-15 16:49:43 +0200
committerJulian Andres Klode <julian.klode@canonical.com>2024-04-19 20:48:34 +0200
commit4d54b35e7a0c073b293d26d075714bef17080d48 (patch)
treecbd703ee61600aa8e88e272182872d80c78394f8
parent760d7d3aa5ac414f05e381e0984430544b1f42d9 (diff)
Keep the entire error/warning/notice message bold
This draws a bit more attention, and improves readability vs keeping the color for the entire message.
-rw-r--r--apt-pkg/contrib/error.cc4
1 files changed, 4 insertions, 0 deletions
diff --git a/apt-pkg/contrib/error.cc b/apt-pkg/contrib/error.cc
index 2cb1191c1..e3cdb7566 100644
--- a/apt-pkg/contrib/error.cc
+++ b/apt-pkg/contrib/error.cc
@@ -252,11 +252,13 @@ void GlobalError::MergeWithStack() {
APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i)
{
static constexpr auto COLOR_RESET = "\033[0m";
+ static constexpr auto COLOR_BOLD = "\033[1m"; // bold neutral
static constexpr auto COLOR_NOTICE = "\033[1m"; // bold neutral
static constexpr auto COLOR_WARN = "\033[1;33m"; // bold yellow
static constexpr auto COLOR_ERROR = "\033[1;31m"; // bold red
bool use_color = _config->FindB("APT::Color", false);
+ auto out_ver = _config->FindI("APT::Output-Version");
if (use_color)
{
@@ -304,6 +306,8 @@ APT_HIDDEN std::ostream &operator<<(std::ostream &out, GlobalError::Item i)
case GlobalError::WARNING:
case GlobalError::NOTICE:
out << COLOR_RESET;
+ if (out_ver >= 30)
+ out << COLOR_BOLD;
break;
default:
break;