Otherwise it is not easy to see what is meant to be a color.
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
#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,
};
// 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 */
"--",
// 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",
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);
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;
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;
#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
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;
#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) {
#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) {
#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) {
#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) {
#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) {
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);