]> git.ipfire.org Git - oddments/collecty.git/commitdiff
colors: Add back the prefix
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Oct 2025 18:01:36 +0000 (18:01 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 30 Oct 2025 18:01:36 +0000 (18:01 +0000)
Otherwise it is not easy to see what is meant to be a color.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
13 files changed:
src/daemon/colors.h
src/daemon/graph.c
src/daemon/graphs/conntrack.c
src/daemon/graphs/contextswitches.c
src/daemon/graphs/cpufreq.c
src/daemon/graphs/graph.h
src/daemon/graphs/hostapd-station-signal.c
src/daemon/graphs/legacy-suricata.c
src/daemon/graphs/loadavg.c
src/daemon/graphs/memory.c
src/daemon/graphs/pressure.c
src/daemon/graphs/processor.c
src/daemon/graphs/uptime.c

index 970bf4590b02c4e75d7fb2dd5081e127ecde036a..1d4f6821e4aa5acfd8840c7a784dcf6dd810ffd5 100644 (file)
 
 #include "util.h"
 
-#define BLACK                  "#000000"
-#define WHITE                  "#ffffff"
-#define GREY                   "#9e9e9e"
-#define RED                            "#f44336"
-#define LIGHT_RED              "#cc0033"
-#define YELLOW                 "#ffeb3b"
-#define LIGHT_YELLOW   "#ffff66"
-#define ORANGE                 "#ff9800"
-#define GREEN                  "#4caf50"
-#define LIGHT_GREEN            "#8bc34a"
-#define BLUE                   "#2196f3"
-#define LIGHT_BLUE             "#03a9f4"
-#define PINK                   "#e91e63"
-#define DEEP_PURPLE            "#673ab7"
+#define COLOR_BLACK                            "#000000"
+#define COLOR_WHITE                            "#ffffff"
+#define COLOR_GREY                             "#9e9e9e"
+#define COLOR_RED                              "#f44336"
+#define COLOR_LIGHT_RED                        "#cc0033"
+#define COLOR_YELLOW                   "#ffeb3b"
+#define COLOR_LIGHT_YELLOW             "#ffff66"
+#define COLOR_ORANGE                   "#ff9800"
+#define COLOR_GREEN                            "#4caf50"
+#define COLOR_LIGHT_GREEN              "#8bc34a"
+#define COLOR_BLUE                             "#2196f3"
+#define COLOR_LIGHT_BLUE               "#03a9f4"
+#define COLOR_PINK                             "#e91e63"
+#define COLOR_DEEP_PURPLE              "#673ab7"
 
 /*
        Define some colours with a special meaning...
 */
 
 // Default - If something does not need to have a special meaning
-#define DEFAULT                        GREY
+#define COLOR_DEFAULT                  COLOR_BLACK
 
 // Limits - When there is a floor/ceiling to resource usage
-#define MINIMUM                        GREEN
-#define MAXIMUM                        RED
-#define LIMIT                  MAXIMUM
+#define COLOR_MINIMUM                  COLOR_GREEN
+#define COLOR_MAXIMUM                  COLOR_RED
+#define COLOR_LIMIT                            COLOR_MAXIMUM
 
 // Define colors for incoming/outgoing traffic
-#define COLOR_RX               GREEN
-#define COLOR_TX               RED
+#define COLOR_RX                               COLOR_GREEN
+#define COLOR_TX                               COLOR_RED
 
 // CPU Colors
 
 static inline const char* COLOR_CPU(long i) {
        const char* cpu_colors[] = {
-               RED,
-               YELLOW,
-               GREEN,
-               ORANGE,
+               COLOR_RED,
+               COLOR_YELLOW,
+               COLOR_GREEN,
+               COLOR_ORANGE,
                NULL,
        };
 
@@ -71,13 +71,13 @@ static inline const char* COLOR_CPU(long i) {
 // Macro to make colours transparent
 #define COLOR_WITH_ALPHA(base, alpha) base alpha
 
-#define OPACITY_100P           "ff"
-#define OPACITY_75P                    "c0"
-#define OPACITY_50P                    "80"
-#define OPACITY_25P                    "40"
-#define OPACITY_0P                     "00"
+#define COLOR_OPACITY_100P             "ff"
+#define COLOR_OPACITY_75P              "c0"
+#define COLOR_OPACITY_50P              "80"
+#define COLOR_OPACITY_25P              "40"
+#define COLOR_OPACITY_0P               "00"
 
 // Fill areas very lightly
-#define OPACITY_AREA           OPACITY_25P
+#define OPACITY_AREA                   COLOR_OPACITY_25P
 
 #endif /* TELEMETRY_COLORS_H */
index cfd1e47dca61d571fb2aa8be0ce2465b9f5f720f..2dde9fa7d1d42a83a5300d66482f5270803f46bf 100644 (file)
@@ -51,7 +51,7 @@ const char* DEFAULT_RENDER_ARGS[] = {
        "--",
 
        // Change the background color
-       "--color=BACK" COLOR_WITH_ALPHA(WHITE, OPACITY_100P),
+       "--color=BACK" COLOR_WITH_ALPHA(COLOR_WHITE, COLOR_OPACITY_100P),
 
        // Disable the border around the image
        "--border=0",
index ca3415678a51dec63e7a2251e59a090b894d8eb8..ce44afbe9edb7eea3d9a43682352ce98adb333f7 100644 (file)
@@ -47,11 +47,11 @@ static int conntrack_render(td_ctx* ctx,
        PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
 
        // Entries
-       DRAW_AREA_WITH_LABEL(args, "count", NULL, GREEN, 0, _("Entries"));
+       DRAW_AREA_WITH_LABEL(args, "count", NULL, COLOR_DEFAULT, 0, _("Entries"));
        PRINT_CAMM(args, "count", NULL, LARGE_INTEGER);
 
        // Limit
-       DRAW_LINE_WITH_LABEL(args, 1, "max", NULL, LIMIT, DASHED|SKIPSCALE, _("Limit"));
+       DRAW_LINE_WITH_LABEL(args, 1, "max", NULL, COLOR_LIMIT, DASHED|SKIPSCALE, _("Limit"));
        PRINT_CURRENT(args, "max", NULL, LARGE_INTEGER);
        PRINT_NOTHING(args);
        PRINT_NOTHING(args);
index 47ac636ea79e17bf08193802d79bbe43bb9de816..ffc55601d8ee484915e95ce8078a52d4b1bfb454 100644 (file)
@@ -47,7 +47,7 @@ static int contextswitches_render(td_ctx* ctx,
        PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
 
        // Context Switches
-       DRAW_AREA_WITH_LABEL(args, "ctxt", NULL, GREEN, 0, _("Context Switches"));
+       DRAW_AREA_WITH_LABEL(args, "ctxt", NULL, COLOR_DEFAULT, 0, _("Context Switches"));
        PRINT_CAMM(args, "ctxt", NULL, LARGE_INTEGER);
 
        return 0;
index 9ab83736bedac7a8c2e904486ef326054a6f8446..e829512fcfc7973bc1cc85a40ef178cfb7ec15a2 100644 (file)
@@ -62,10 +62,10 @@ static int cpufreq_render(td_ctx* ctx,
                PRINT_CAMM(args, "freq_cur", object, HZ);
 
                // Draw the minimum
-               DRAW_LINE(args, 2, "freq_min", object, MINIMUM, 0);
+               DRAW_LINE(args, 2, "freq_min", object, COLOR_MINIMUM, 0);
 
                // Draw the maximum
-               DRAW_LINE(args, 2, "freq_max", object, MAXIMUM, 0);
+               DRAW_LINE(args, 2, "freq_max", object, COLOR_MAXIMUM, 0);
        }
 
        return 0;
index 4644bb47968588438260179ae4e144a6c6c4a10c..720594f86297ba52800cc6d604b10802f91aee95 100644 (file)
@@ -69,6 +69,7 @@ typedef enum flags {
 #define FLOAT_WITH_UNIT "%%10.2lf %3s"
 #define LARGE_FLOAT            "%%14.2lf %%s"
 #define BPS                            "%%9.2lf %%s%3s", _("bps")
+#define QPS                            "%%14.2lf %3s", _("qps")
 #define HZ                             "%%10.2lf %%s%2s", _("Hz")
 
 // Macro to terminate a line
index d7828813f5a1e2db524a3f8e1ec905e5a9610588..903f489409126239531463b4bc0c149ff2cae971 100644 (file)
@@ -59,16 +59,16 @@ static int hostapd_station_signal_render(td_ctx* ctx,
        PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum"));
 
        // Draw signal
-       DRAW_LINE_WITH_LABEL(args, 2, "signal", object, GREEN, 0, _("Signal"));
+       DRAW_LINE_WITH_LABEL(args, 2, "signal", object, COLOR_GREEN, 0, _("Signal"));
        PRINT_CAMM(args, "signal", object, FLOAT_WITH_UNIT, _("dBm"));
 
        // Draw the lower signal quality in different colors
-       DRAW_LINE(args, 2, "signal_good", object, YELLOW, 0);
-       DRAW_LINE(args, 2, "signal_fair", object, ORANGE, 0);
-       DRAW_LINE(args, 2, "signal_poor", object, RED, 0);
+       DRAW_LINE(args, 2, "signal_good", object, COLOR_YELLOW, 0);
+       DRAW_LINE(args, 2, "signal_fair", object, COLOR_ORANGE, 0);
+       DRAW_LINE(args, 2, "signal_poor", object, COLOR_RED, 0);
 
        // Draw last ACK signal
-       DRAW_LINE_WITH_LABEL(args, 2, "last_ack_signal", object, GREY, 0, _("Last ACK Signal"));
+       DRAW_LINE_WITH_LABEL(args, 2, "last_ack_signal", object, COLOR_DEFAULT, 0, _("Last ACK Signal"));
        PRINT_CAMM(args, "last_ack_signal", object, FLOAT_WITH_UNIT, _("dBm"));
 
        return 0;
index a9cf4dcf987e75c55ef846b5b99e38e810f86165..eafeb46682b031985c8f9339e65ec9e8d8393a97 100644 (file)
@@ -23,9 +23,9 @@
 #include "graph.h"
 #include "legacy-suricata.h"
 
-#define COLOR_WHITELISTED GREEN
-#define COLOR_BYPASSED    ORANGE
-#define COLOR_SCANNED     RED
+#define COLOR_WHITELISTED COLOR_GREEN
+#define COLOR_BYPASSED    COLOR_ORANGE
+#define COLOR_SCANNED     COLOR_RED
 
 static int legacy_suricata_title(td_ctx* ctx, td_graph* graph,
                const char* object, char* title, size_t length) {
index 7300e809f541e11d45fa541f105e74a5aa2a0982..613e25e22ffe32bc1727928623fca1df8f123854 100644 (file)
@@ -25,9 +25,9 @@
 #include "loadavg.h"
 
 // Set some colors
-#define COLOR_LOAD15   RED
-#define COLOR_LOAD5            ORANGE
-#define COLOR_LOAD1            YELLOW
+#define COLOR_LOAD15   COLOR_RED
+#define COLOR_LOAD5            COLOR_ORANGE
+#define COLOR_LOAD1            COLOR_YELLOW
 
 static int loadavg_title(td_ctx* ctx, td_graph* graph,
                const char* object, char* title, size_t length) {
index 0fa456bded3b0350368e48c5df57306fdee5733f..00f1d8787f36fbd2d96d492f9f3e0383b721b3d5 100644 (file)
 #include "memory.h"
 
 // Set some colors
-#define COLOR_MEM_TOTAL                RED
-#define COLOR_MEM_USED         BLUE
-#define COLOR_BUFFERS          GREEN
-#define COLOR_CACHED           GREY
-#define COLOR_SWAP_USED                RED
-#define COLOR_SWAP_TOTAL       BLACK
+#define COLOR_MEM_TOTAL                COLOR_RED
+#define COLOR_MEM_USED         COLOR_BLUE
+#define COLOR_BUFFERS          COLOR_GREEN
+#define COLOR_CACHED           COLOR_GREY
+#define COLOR_SWAP_USED                COLOR_RED
+#define COLOR_SWAP_TOTAL       COLOR_BLACK
 
 static int memory_title(td_ctx* ctx, td_graph* graph,
                const char* object, char* title, size_t length) {
index cb6203b9753165eb0a788a583f35c759c790e3fb..019ca97d58c716843dc51a08f10e3065f3b437e2 100644 (file)
@@ -25,9 +25,9 @@
 #include "pressure.h"
 
 // Set some colors
-#define COLOR_LOAD300  RED
-#define COLOR_LOAD60   ORANGE
-#define COLOR_LOAD10   YELLOW
+#define COLOR_LOAD300  COLOR_RED
+#define COLOR_LOAD60   COLOR_ORANGE
+#define COLOR_LOAD10   COLOR_YELLOW
 
 static int pressure_render(td_ctx* ctx,
                td_graph* graph, td_args* args, const char* source) {
index 76e6829b44e03619c09f220201fa7fc0427901ff..66142a2d97e887fd2cac5dc8c00d287596b20fa4 100644 (file)
 #include "processor.h"
 
 // Set some colors
-#define COLOR_USER                     LIGHT_GREEN
-#define COLOR_NICE                     BLUE
-#define COLOR_SYS                      RED
-#define COLOR_WAIT                     DEEP_PURPLE
-#define COLOR_IRQ                      ORANGE
-#define COLOR_SOFTIRQ          YELLOW
-#define COLOR_STEAL                    LIGHT_BLUE
-#define COLOR_GUEST                    PINK
-#define COLOR_GUEST_NICE       PINK
-#define COLOR_IDLE                     LIGHT_GREY
+#define COLOR_USER                     COLOR_LIGHT_GREEN
+#define COLOR_NICE                     COLOR_BLUE
+#define COLOR_SYS                      COLOR_RED
+#define COLOR_WAIT                     COLOR_DEEP_PURPLE
+#define COLOR_IRQ                      COLOR_ORANGE
+#define COLOR_SOFTIRQ          COLOR_YELLOW
+#define COLOR_STEAL                    COLOR_LIGHT_BLUE
+#define COLOR_GUEST                    COLOR_PINK
+#define COLOR_GUEST_NICE       COLOR_PINK
+#define COLOR_IDLE                     COLOR_LIGHT_GREY
 
 static int processor_title(td_ctx* ctx, td_graph* graph,
                const char* object, char* title, size_t length) {
index b673ba85c00d9d464124247fcd532823c0315b16..c5ce5fa5c844bb9e6ca3903dc4ced0483b44ef89 100644 (file)
@@ -50,7 +50,7 @@ static int uptime_render(td_ctx* ctx,
        PRINT_HEADER1(args, _("Current"));
 
        // Draw the uptime
-       DRAW_AREA_WITH_LABEL(args, "uptime_days", NULL, DEFAULT, 0, _("Uptime"));
+       DRAW_AREA_WITH_LABEL(args, "uptime_days", NULL, COLOR_DEFAULT, 0, _("Uptime"));
        PRINT(args, "uptime_days_cur", NULL, INTEGER);
        PRINT_EOL(args);