diff mbox series

iproute2: color: default to dark background

Message ID 01a20e83-c05e-4006-b64c-3edd34508296@gedalya.net (mailing list archive)
State Rejected
Delegated to: David Ahern
Headers show
Series iproute2: color: default to dark background | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Gedalya May 22, 2024, 7:28 p.m. UTC
Signed-off-by: Gedalya Nie <gedalya@gedalya.net>
---
lib/color.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

* 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)))

Comments

Stephen Hemminger May 22, 2024, 8:59 p.m. UTC | #1
On Thu, 23 May 2024 03:28:16 +0800
Gedalya Nie <gedalya@gedalya.net> wrote:

> 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)))
> 

You mailer mangled this.

WARNING: Missing commit description - Add an appropriate one

ERROR: patch seems to be corrupt (line wrapped?)
#115: FILE: lib/color.c:71:
C_CLEAR

total: 1 errors, 1 warnings, 25 lines checked
diff mbox series

Patch

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