From: Michael Stapelberg Date: Sun, 14 Feb 2010 11:49:03 +0000 (+0100) Subject: Colorize ethernet output (patch by Peter Johnson) X-Git-Tag: 2.1~10 X-Git-Url: https://git.sur5r.net/?p=i3%2Fi3status;a=commitdiff_plain;h=3eec92d504444ad4f0c59b42ea961a3dedd9ebc2 Colorize ethernet output (patch by Peter Johnson) --- diff --git a/src/print_eth_info.c b/src/print_eth_info.c index 1da0502..9ad9b92 100644 --- a/src/print_eth_info.c +++ b/src/print_eth_info.c @@ -79,8 +79,12 @@ void print_eth_info(const char *interface, const char *format_up, const char *fo const char *ip_address = get_ip_addr(interface); if (ip_address == NULL) { + printf("%s", color("#FF0000")); printf("%s", format_down); + (void)printf("%s", endcolor()); return; + } else { + printf("%s", color("#00FF00")); } for (walk = format_up; *walk != '\0'; walk++) { @@ -97,4 +101,6 @@ void print_eth_info(const char *interface, const char *format_up, const char *fo walk += strlen("speed"); } } + + (void)printf("%s", endcolor()); }