netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] [resend] color: default to dark background
@ 2024-05-22 18:43 Gedalya Nie
  2024-05-22 20:57 ` Stephen Hemminger
  0 siblings, 1 reply; 11+ messages in thread
From: Gedalya Nie @ 2024-05-22 18:43 UTC (permalink / raw)
  To: netdev

Signed-off-by: Gedalya Nie <gedalya@gedalya.net>
---
 lib/color.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/color.c b/lib/color.c
index cd0f9f75..6692f9c1 100644
--- a/lib/color.c
+++ b/lib/color.c
@@ -72,7 +72,7 @@ static enum color attr_colors_dark[] = {
 	C_CLEAR
 };
 
-static int is_dark_bg;
+static int is_dark_bg = 1;
 static int color_is_enabled;
 
 static void enable_color(void)
@@ -127,11 +127,11 @@ static void set_color_palette(void)
 	 * COLORFGBG environment variable usually contains either two or three
 	 * values separated by semicolons; we want the last value in either case.
 	 * If this value is 0-6 or 8, background is dark.
+	 * If it is 7, 9 or greater, background is light.
 	 */
 	if (p && (p = strrchr(p, ';')) != NULL
-		&& ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
-		&& p[2] == '\0')
-		is_dark_bg = 1;
+		&& (p[1] == '7' || p[1] == '9' || p[2] != '\0'))
+		is_dark_bg = 0;
 }
 
 __attribute__((format(printf, 3, 4)))
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-05-23  0:14 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-22 18:43 [PATCH] [resend] color: default to dark background Gedalya Nie
2024-05-22 20:57 ` Stephen Hemminger
2024-05-22 21:01   ` Gedalya
2024-05-22 21:02     ` Dragan Simic
2024-05-22 21:33       ` Stephen Hemminger
2024-05-22 22:16         ` Gedalya
     [not found]         ` <5b8dfe40-e72e-4310-85b5-aa607bad1638@gedalya.net>
2024-05-22 22:52           ` Stephen Hemminger
2024-05-22 23:02             ` Gedalya
2024-05-22 23:41             ` Gedalya
2024-05-23  0:12               ` Dragan Simic
2024-05-23  0:14                 ` Dragan Simic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).