summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2025-05-04 17:39:05 -0700
committerVito Caputo <vcaputo@pengaru.com>2025-05-04 17:47:46 -0700
commiteeaa389328bd8e7d4b3a1954e1d18978162fed42 (patch)
treede3adaefe60e3db970fa98cdf13bbabcde54679f
parent55fdd41ae125fd12d6e8deec493037469d1c0888 (diff)
vcr: fill out the available PNG graph colors
I've picked some colors just to have /something/ populating these. For now only the first two (red and cyan) are being used, but subsequent commits will wire these up to a per-row palette selector which the charts code will set appropriately and vcr will need to consult when presenting the charts to png/X. It's tempting to make the colors user-definable at run-time. But that actually seems like a bad idea. Instead, I expect to iterate on these until a Good Enough set of colors is arrived at, then leave them hard-coded in the source. Why? you may ask... well, it's simple - I want everyone using vmon to develop a familiarity with grokking the output in a way that's consistent and transferrable if they encounter it elsewhere, or if people pass around the snapshots / attach them to GH/JIRA tickets etc. We shouldn't need a decoder wheel to understand what the colors mean to a given use case. The source defines the meaning of the colors, and once the dust settles, it should try stay as consistent as possible.
-rw-r--r--src/vcr.c44
1 files changed, 34 insertions, 10 deletions
diff --git a/src/vcr.c b/src/vcr.c
index 65f5a68..18cf301 100644
--- a/src/vcr.c
+++ b/src/vcr.c
@@ -2076,8 +2076,16 @@ static int vcr_present_xlib_to_png(vcr_t *vcr, vcr_dest_t *dest)
/* when without shadow */
#define VCR_PNG_WHITE {0xff, 0xff, 0xff}
-#define VCR_PNG_RED {0xff, 0x00, 0x00}
-#define VCR_PNG_CYAN {0x00, 0xff, 0xff}
+#define VCR_PNG_RED {0xff, 0x00, 0x00} /* ROWSUB0::GRAPHA */
+#define VCR_PNG_CYAN {0x00, 0xff, 0xff} /* ROWSUB0::GRAPHB */
+#define VCR_PNG_MAGENTA {0xff, 0x00, 0xff} /* ROWSUB1::GRAPHA */
+#define VCR_PNG_GREEN {0x00, 0xff, 0x00} /* ROWSUB1::GRAPHB */
+#define VCR_PNG_MAUVE {0xd7, 0x73, 0xd4} /* ROWSUB2::GRAPHA */
+#define VCR_PNG_ORANGE {0xff, 0xa5, 0x00} /* ROWSUB2::GRAPHB */
+#define VCR_PNG_CHOCOLATE {0x7b, 0x3f, 0x00} /* ROWSUB3::GRAPHA */
+#define VCR_PNG_PINK {0xff, 0xc0, 0xcb} /* ROWSUB3::GRAPHB */
+#define VCR_PNG_SANDY {0xf4, 0xa4, 0x60} /* ROWSUB4::GRAPHA */
+#define VCR_PNG_ULTRAMARINE {0x12, 0x0a, 0x8f} /* ROWSUB4::GRAPHB */
#define VCR_PNG_YELLOW {0xc0, 0xc0, 0x00}
#define VCR_PNG_DARK_GRAY {0x30, 0x30, 0x30} /* used for separator */
#define VCR_PNG_DARKER_GRAY {0x10, 0x10, 0x10} /* used for odd rows background */
@@ -2088,8 +2096,16 @@ static int vcr_present_xlib_to_png(vcr_t *vcr, vcr_dest_t *dest)
enum {
VCR_LUT_BLACK = 0,
VCR_LUT_WHITE,
- VCR_LUT_RED,
- VCR_LUT_CYAN,
+ VCR_LUT_ROWSUB0_A,
+ VCR_LUT_ROWSUB0_B,
+ VCR_LUT_ROWSUB1_A,
+ VCR_LUT_ROWSUB1_B,
+ VCR_LUT_ROWSUB2_A,
+ VCR_LUT_ROWSUB2_B,
+ VCR_LUT_ROWSUB3_A,
+ VCR_LUT_ROWSUB3_B,
+ VCR_LUT_ROWSUB4_A,
+ VCR_LUT_ROWSUB4_B,
VCR_LUT_YELLOW,
VCR_LUT_DARK_GRAY,
VCR_LUT_DARKER_GRAY,
@@ -2110,8 +2126,16 @@ static int vcr_present_mem_to_png(vcr_t *vcr, vcr_dest_t *dest)
static png_color pal[16] = { /* programming gfx like it's 1990 can be such a joy */
[VCR_LUT_BLACK] = {},
[VCR_LUT_WHITE] = VCR_PNG_WHITE,
- [VCR_LUT_RED] = VCR_PNG_RED,
- [VCR_LUT_CYAN] = VCR_PNG_CYAN,
+ [VCR_LUT_ROWSUB0_A] = VCR_PNG_RED,
+ [VCR_LUT_ROWSUB0_B] = VCR_PNG_CYAN,
+ [VCR_LUT_ROWSUB1_A] = VCR_PNG_MAGENTA,
+ [VCR_LUT_ROWSUB1_B] = VCR_PNG_GREEN,
+ [VCR_LUT_ROWSUB2_A] = VCR_PNG_MAUVE,
+ [VCR_LUT_ROWSUB2_B] = VCR_PNG_ORANGE,
+ [VCR_LUT_ROWSUB3_A] = VCR_PNG_CHOCOLATE,
+ [VCR_LUT_ROWSUB3_B] = VCR_PNG_PINK,
+ [VCR_LUT_ROWSUB4_A] = VCR_PNG_SANDY,
+ [VCR_LUT_ROWSUB4_B] = VCR_PNG_ULTRAMARINE,
[VCR_LUT_YELLOW] = VCR_PNG_YELLOW,
[VCR_LUT_DARK_GRAY] = VCR_PNG_DARK_GRAY,
[VCR_LUT_DARKER_GRAY] = VCR_PNG_DARKER_GRAY,
@@ -2147,11 +2171,11 @@ static int vcr_present_mem_to_png(vcr_t *vcr, vcr_dest_t *dest)
[VCR_TEXT_ODD_GRAPHAB_SHADOW] = VCR_LUT_WHITE,
/* no shadow or text, plain graph colors */
- [VCR_GRAPHA] = VCR_LUT_RED,
- [VCR_GRAPHB] = VCR_LUT_CYAN,
+ [VCR_GRAPHA] = VCR_LUT_ROWSUB0_A,
+ [VCR_GRAPHB] = VCR_LUT_ROWSUB0_B,
[VCR_GRAPHAB] = VCR_LUT_WHITE,
- [VCR_GRAPHA_ODD] = VCR_LUT_RED,
- [VCR_GRAPHB_ODD] = VCR_LUT_CYAN,
+ [VCR_GRAPHA_ODD] = VCR_LUT_ROWSUB0_A,
+ [VCR_GRAPHB_ODD] = VCR_LUT_ROWSUB0_B,
[VCR_GRAPHAB_ODD] = VCR_LUT_WHITE,
/* shadowed same but dark */
© All Rights Reserved