]> git.ipfire.org Git - thirdparty/iproute2.git/commit
color: Assume background is dark if unknown
authorBen Hutchings <benh@debian.org>
Wed, 26 Mar 2025 14:08:29 +0000 (15:08 +0100)
committerDavid Ahern <dsahern@kernel.org>
Tue, 1 Apr 2025 03:36:58 +0000 (03:36 +0000)
commitcc0f1109d2864686180ba2ce6fba5fcb3bf437bf
tree17f3a504b49bc0db10981207a56c3aa3fc94f677
parente4e55167d004c01abbdac164bd01d1a5177bfa0d
color: Assume background is dark if unknown

We rely on the COLORFGBG environment variable to tell us whether the
background is dark.  This variable is set by Konsole and rxvt but not
by GNOME Terminal or xterm.  This means we use the wrong set of
colours when GNOME Terminal or xterm is configured with a dark
background.

It appears to me that the dark-background colour palette works better
on a light background than vice versa.  So it is better to assume a
dark background if we cannot find this out from $COLORFGBG.

- Change the initial value of is_dark_bg to 1.
- In set_color_palette(). conditinally set is_dark_bg to 0 with an
  inverted test of the colour.

Signed-off-by: Ben Hutchings <benh@debian.org>
lib/color.c