From: Michael Tremer Date: Tue, 21 Oct 2025 14:12:50 +0000 (+0000) Subject: colors: Define a special color for rx/tx traffic X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=54217a39c502abb7e6ff2aab0b661af0a3ebffd9;p=oddments%2Fcollecty.git colors: Define a special color for rx/tx traffic Signed-off-by: Michael Tremer --- diff --git a/src/daemon/colors.h b/src/daemon/colors.h index 3ee5b85..09577ce 100644 --- a/src/daemon/colors.h +++ b/src/daemon/colors.h @@ -46,6 +46,10 @@ // Limit - When there is a ceiling to resource usage #define LIMIT RED +// Define colors for incoming/outgoing traffic +#define COLOR_RX GREEN +#define COLOR_TX RED + // Macro to make colours transparent #define COLOR_WITH_ALPHA(base, alpha) base alpha diff --git a/src/daemon/graphs/graph.h b/src/daemon/graphs/graph.h index b175314..dc51b72 100644 --- a/src/daemon/graphs/graph.h +++ b/src/daemon/graphs/graph.h @@ -280,10 +280,10 @@ } while (0) #define DRAW_BANDWIDTH_INCOMING(args, object, rx_bytes) \ - __DRAW_BANDWIDTH(args, object, rx_bytes, GREEN, _("Incoming Traffic")) + __DRAW_BANDWIDTH(args, object, rx_bytes, COLOR_RX, _("Incoming Traffic")) #define DRAW_BANDWIDTH_OUTGOING(args, object, tx_bytes) \ - __DRAW_BANDWIDTH(args, object, tx_bytes, RED, _("Outgoing Traffic")) + __DRAW_BANDWIDTH(args, object, tx_bytes, COLOR_TX, _("Outgoing Traffic")) #define __DRAW_BANDWIDTH(args, object, bytes, color, label) \ do { \ diff --git a/src/daemon/graphs/hostapd-station-rate-info.c b/src/daemon/graphs/hostapd-station-rate-info.c index a94c93f..7a5c208 100644 --- a/src/daemon/graphs/hostapd-station-rate-info.c +++ b/src/daemon/graphs/hostapd-station-rate-info.c @@ -47,11 +47,11 @@ static int hostapd_station_rate_info_render(td_ctx* ctx, PRINT_HEADER4(args, _("Current"), _("Average"), _("Minimum"), _("Maximum")); // Receive Rate - DRAW_LINE2_WITH_LABEL(args, "rx_rate", object, GREEN, _("Receive Rate")); + DRAW_LINE2_WITH_LABEL(args, "rx_rate", object, COLOR_RX, _("Receive Rate")); PRINT_CAMM(args, "rx_rate", object, BPS, _("Bps")); // Transmit Rate - DRAW_LINE2_WITH_LABEL(args, "tx_rate", object, RED, _("Transmit Rate")); + DRAW_LINE2_WITH_LABEL(args, "tx_rate", object, COLOR_TX, _("Transmit Rate")); PRINT_CAMM(args, "tx_rate", object, BPS, _("Bps")); return 0;