From 665fd156d476563148015a174d8c695a1350bfa4 Mon Sep 17 00:00:00 2001 From: norly Date: Wed, 2 Oct 2013 15:42:39 +0200 Subject: [PATCH] Change named colors to hex values --- src/status/battery.c | 10 +++++----- src/status/cpuusage.c | 2 +- src/status/datetime.c | 4 ++-- src/status/fan.c | 2 +- src/status/memusage.c | 4 ++-- src/status/netif.c | 6 +++--- src/status/temp.c | 2 +- src/status/uptime.c | 2 +- src/status/volume_alsa.c | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/status/battery.c b/src/status/battery.c index 65fdd1b..329e531 100644 --- a/src/status/battery.c +++ b/src/status/battery.c @@ -79,21 +79,21 @@ void status_battery(GlobalData *g, char *batname) if (chargePercent <= 40) { if (chargePercent <= 25) { if (chargePercent <= 10) { - s.color = "red"; + s.color = "#FF0000"; // red } else { // 11-25% - s.color = "orange"; + s.color = "#FFA500"; // orange } } else { // 26-40% - s.color = "yellow"; + s.color = "#FFFF00"; // yellow } } else { if (chargePercent > 70) { - s.color = "white"; + s.color = "#FFFFFF"; // white } else { // 41-70% - s.color = "green"; + s.color = "#22FF22"; // green } } diff --git a/src/status/cpuusage.c b/src/status/cpuusage.c index a3b1d5d..bf82fe6 100644 --- a/src/status/cpuusage.c +++ b/src/status/cpuusage.c @@ -45,7 +45,7 @@ void status_cpuusage(GlobalData *g) s.text = text; // Error signaling color - s.color = "yellow"; + s.color = "#FFFF00"; // yellow stfile = fopen("/proc/stat", "r"); if (stfile != NULL) { diff --git a/src/status/datetime.c b/src/status/datetime.c index d7d9d0a..304b858 100644 --- a/src/status/datetime.c +++ b/src/status/datetime.c @@ -19,7 +19,7 @@ void status_datetime(GlobalData *g) nows = time(NULL); if (nows == ((time_t) -1)) { - s.color = "red"; + s.color = "#FF0000"; // red s.text = "ERROR: DATETIME"; line_append_item(g, &s); @@ -35,7 +35,7 @@ void status_datetime(GlobalData *g) ); line_append_item(g, &s); - s.color = "grey"; + s.color = "#BEBEBE"; // grey snprintf(text, sizeof(text), "%d:%.2d" #ifdef SHOW_SECONDS diff --git a/src/status/fan.c b/src/status/fan.c index 6b26678..0977814 100644 --- a/src/status/fan.c +++ b/src/status/fan.c @@ -25,7 +25,7 @@ void status_fan(GlobalData *g, char *title, char *sysfile) // Read a valid value? Sometimes we get garbage from sysfs... if (stlen > 5) { - s.color = "red"; + s.color = "#FF0000"; // red snprintf(text, sizeof(text), "%sERROR", title); } else { stline[stlen - 1] = '\0'; diff --git a/src/status/memusage.c b/src/status/memusage.c index f69c027..6e71514 100644 --- a/src/status/memusage.c +++ b/src/status/memusage.c @@ -47,9 +47,9 @@ void status_memusage(GlobalData *g) /* Change color based on % of RAM used */ if ((float)memused / (float)memtotal < 0.85) { - s.color = "green"; + s.color = "#22FF22"; // green } else { - s.color = "red"; + s.color = "#FF0000"; // red } snprintf(text, sizeof(text), "Mem: %d M", memused); diff --git a/src/status/netif.c b/src/status/netif.c index 3c0fef0..e760b4c 100644 --- a/src/status/netif.c +++ b/src/status/netif.c @@ -44,7 +44,7 @@ void status_netif(GlobalData *g, char *ifname) /* Is the interface up? */ if (access(ifpath, F_OK)) { - //s.color = "grey"; + //s.color = "#BEBEBE"; // grey return; } @@ -53,9 +53,9 @@ void status_netif(GlobalData *g, char *ifname) stlen = fileRead(stline, sizeof(stline), ifpath); if (stlen > 0) { if (stline[0] == '1') { - s.color = "yellow"; + s.color = "#FFFF00"; // yellow } else { - //s.color = "red"; + //s.color = "#FF0000"; // red return; } } else { diff --git a/src/status/temp.c b/src/status/temp.c index c102fcd..bcd189a 100644 --- a/src/status/temp.c +++ b/src/status/temp.c @@ -28,7 +28,7 @@ void status_temp(GlobalData *g, char *title, char *sysfile) * Sometimes we get garbage from sysfs... */ if (stlen < 6 || stlen > 7) { - s.color = "red"; + s.color = "#FF0000"; // red snprintf(text, sizeof(text), "%sERROR", title); } else { stline[stlen - 4] = '\0'; diff --git a/src/status/uptime.c b/src/status/uptime.c index ef5b2e5..d82d068 100644 --- a/src/status/uptime.c +++ b/src/status/uptime.c @@ -23,7 +23,7 @@ void status_uptime(GlobalData *g) stlen = fileRead(stline, sizeof(stline), "/proc/uptime"); if (stlen < 0) { - s.color = "red"; + s.color = "#FF0000"; // red s.text = "up: ERROR"; } else { unsigned textlen = 0; diff --git a/src/status/volume_alsa.c b/src/status/volume_alsa.c index 54fe44e..bdef666 100644 --- a/src/status/volume_alsa.c +++ b/src/status/volume_alsa.c @@ -54,7 +54,7 @@ int status_volume_alsa(GlobalData *g, snd_mixer_selem_get_playback_volume_range(elem, &min, &max); snd_mixer_selem_get_playback_volume(elem, channel, &volume); - s.color = on_off ? "#22FF22" : "red"; + s.color = on_off ? "#22FF22" : "#FF0000"; // green/red snprintf(text, sizeof(text), "Vol: %d", (int)volume); } -- 2.30.2