lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zk722SwDWVe35Ssu@photonic.trudheim.com>
Date: Thu, 23 May 2024 09:57:13 +0200
From: Sirius <sirius@...dheim.com>
To: Gedalya <gedalya@...alya.net>
Cc: netdev@...r.kernel.org
Subject: Re: iproute2: color output should assume dark background

In days of yore (Thu, 23 May 2024), Gedalya thus quoth: 
> On 5/23/24 2:39 PM, Sirius wrote:
> > what terminal background should be used,
> It's not about prescribing what should, but about guessing what is, when that is not explicitly stated. The only "right" way to guess is to always choose what is more probable (common, in this case).

Appeal to authority.

> > read what the background is of the console
> That's COLORFGBG. It is set by some terminal emulators as a way to
> advertise the colors being used.
> 
> I'm no expert but AFAIK there is no uniform way to do this that is
> supported by all major terminal emulators.

https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Control-Bytes_-Characters_-and-Sequences
https://stackoverflow.com/questions/2507337/how-to-determine-a-terminals-background-color

If you colour the output, then handling the prospect that the background
might not be the assumed colour kind of comes with the territory.
Or you deliberately set the background colour to something so that it is
not undefined. That is what the ANSI colour sequences can do when you use
strings like \e[32;47m where you deliberately set the background.

> > adapt the foreground colours to that. I would guess that means holding
> > two sets of the eight colours and if the background is "dark", use the
> > lighter set and if the background is "light", use the darker set.
> 
> That's what iproute2 currently does.
> 
> In fact this can't be adequate. You can't turn the question of best
> contrast against 16(million?) different colors into a binary. But this
> is a simple CLI command, not a full-screen productivity app.

If the background as read from terminal is > 127 it is "light", if it is <
127, it is "dark".

Xterm, the sequence \e]11;?\a will give you the background colour, zutty
does too, urxvt does not.

Maybe colouring the output by default isn't such a wise idea as utilities
reading the output now must strip control-codes before the output can be
parsed. Why not leave it as an option via the -c[olor] switch like before?

-- 
Kind regards,

/S

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ