[pacman-dev,1/1] conf: replace grey46 with bright black

Message ID 20210614152439.59285-1-list@eworm.de
State New
Headers show
Series [pacman-dev,1/1] conf: replace grey46 with bright black | expand

Commit Message

Christian Hesse June 14, 2021, 3:24 p.m. UTC
From: Christian Hesse <mail@eworm.de>

This is not handled correctly in some situations. For me (with pacman
inside tmux inside xfce4-terminal with TERM=xterm) I do not see version
strings but huge gaps between package names. Looks like grey46 is round
to just back, which is my background color.

Instead use bright black, which is one of the 16 colors and *should* be
visible with any configuration. Works for me[tm] and all configurations
I tested.

Signed-off-by: Christian Hesse <mail@eworm.de>
---
 src/pacman/conf.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

Comments

Allan McRae June 14, 2021, 9:44 p.m. UTC | #1
On 15/6/21 1:24 am, Christian Hesse wrote:
> From: Christian Hesse <mail@eworm.de>
> 
> This is not handled correctly in some situations. For me (with pacman
> inside tmux inside xfce4-terminal with TERM=xterm) I do not see version
> strings but huge gaps between package names. Looks like grey46 is round
> to just back, which is my background color.
> 
> Instead use bright black, which is one of the 16 colors and *should* be
> visible with any configuration. Works for me[tm] and all configurations
> I tested.

Is there a reason to use TERM=xterm and not something that supports 256
colours?

I remember discussing 16 colour terminals at the time this was
implemented and deciding they could us NoColor...

Allan
Allan McRae June 14, 2021, 10:23 p.m. UTC | #2
On 15/6/21 7:44 am, Allan McRae wrote:
> On 15/6/21 1:24 am, Christian Hesse wrote:
>> From: Christian Hesse <mail@eworm.de>
>>
>> This is not handled correctly in some situations. For me (with pacman
>> inside tmux inside xfce4-terminal with TERM=xterm) I do not see version
>> strings but huge gaps between package names. Looks like grey46 is round
>> to just back, which is my background color.
>>
>> Instead use bright black, which is one of the 16 colors and *should* be
>> visible with any configuration. Works for me[tm] and all configurations
>> I tested.
> 
> Is there a reason to use TERM=xterm and not something that supports 256
> colours?
> 
> I remember discussing 16 colour terminals at the time this was
> implemented and deciding they could us NoColor...
> 

BTW - patch rejected.   Try in a terminal with white background.

Allan
Christian Hesse June 15, 2021, 7:05 a.m. UTC | #3
Allan McRae <allan@archlinux.org> on Tue, 2021/06/15 08:23:
> On 15/6/21 7:44 am, Allan McRae wrote:
> > On 15/6/21 1:24 am, Christian Hesse wrote:  
> >> From: Christian Hesse <mail@eworm.de>
> >>
> >> This is not handled correctly in some situations. For me (with pacman
> >> inside tmux inside xfce4-terminal with TERM=xterm) I do not see version
> >> strings but huge gaps between package names. Looks like grey46 is round
> >> to just back, which is my background color.
> >>
> >> Instead use bright black, which is one of the 16 colors and *should* be
> >> visible with any configuration. Works for me[tm] and all configurations
> >> I tested.  
> > 
> > Is there a reason to use TERM=xterm and not something that supports 256
> > colours?

I use some applications that decide to use fancy themes with pastel colors
when 256 colors are available. Colors are hard to differentiate then,
especially in bad light conditions.

Just forcing to use 16 colors was the easiest fix there. Did not miss
anything till now.

> > I remember discussing 16 colour terminals at the time this was
> > implemented and deciding they could us NoColor...
> >   
> 
> BTW - patch rejected.   Try in a terminal with white background.

Too bad... Given that a proper solution with 16 colors does exist I can not
understand the rationale here.

Well, just about to enable VerbosePkgLists then... That prevents the issue
as well.
Emil Velikov June 15, 2021, 12:41 p.m. UTC | #4
On Mon, 14 Jun 2021 at 22:44, Allan McRae <allan@archlinux.org> wrote:
>
> On 15/6/21 1:24 am, Christian Hesse wrote:
> > From: Christian Hesse <mail@eworm.de>
> >
> > This is not handled correctly in some situations. For me (with pacman
> > inside tmux inside xfce4-terminal with TERM=xterm) I do not see version
> > strings but huge gaps between package names. Looks like grey46 is round
> > to just back, which is my background color.
> >
> > Instead use bright black, which is one of the 16 colors and *should* be
> > visible with any configuration. Works for me[tm] and all configurations
> > I tested.
>
> Is there a reason to use TERM=xterm and not something that supports 256
> colours?
>
> I remember discussing 16 colour terminals at the time this was
> implemented and deciding they could us NoColor...
>
Would it make sense for pacman to fallback to NoColor with an error
message, when 256 colors are not supported?
Sort of how it already skips VerbosePkgLists when there aren't enough columns.

-Emil

Patch

diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index 12fee64c..afbd677f 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -55,6 +55,8 @@  config_t *config = NULL;
 #define CYAN          "\033[0;36m"
 #define WHITE         "\033[0;37m"
 
+#define BRIGHTBLACK   "\033[0;30;1m"
+
 #define BOLDBLACK     "\033[1;30m"
 #define BOLDRED       "\033[1;31m"
 #define BOLDGREEN     "\033[1;32m"
@@ -63,7 +65,6 @@  config_t *config = NULL;
 #define BOLDMAGENTA   "\033[1;35m"
 #define BOLDCYAN      "\033[1;36m"
 #define BOLDWHITE     "\033[1;37m"
-#define GREY46        "\033[38;5;243m"
 
 void enable_colors(int colors)
 {
@@ -78,7 +79,7 @@  void enable_colors(int colors)
 		colstr->meta    = BOLDCYAN;
 		colstr->warn    = BOLDYELLOW;
 		colstr->err     = BOLDRED;
-		colstr->faint   = GREY46;
+		colstr->faint   = BRIGHTBLACK;
 		colstr->nocolor = NOCOLOR;
 	} else {
 		colstr->colon   = ":: ";