]> git.draconx.ca Git - rrace.git/blobdiff - t/ewmhicon.c
Make tile colours configurable via X resources.
[rrace.git] / t / ewmhicon.c
index 2ce721cd94c930f5b0c36ce0084c3a9ee2b7f0da..fd92e324a8f594e86bba505c37058278cb74a10d 100644 (file)
@@ -27,6 +27,7 @@
 #include <getopt.h>
 
 #include "ewmhicon.h"
+#include "colour.h"
 #include "help.h"
 
 static const char *progname = "ewmhicon";
@@ -38,23 +39,30 @@ static const struct option lopts[] = {
        { 0 }
 };
 
+#define PASTE(a, b) a ## b
+#define INDIR(a) a
+
 #define S8TO16(x) ((x) * 0xfffful / 0xff)
-#define RGB8(r, g, b) { \
-       0xff000000|(r ## ul)<<16|(g ## ul)<<8|(b ## ul), \
+
+#define RGB8_(r, g, b) { \
+       0xff000000 | (r << 16) | (g << 8) | b, \
        S8TO16(r), S8TO16(g), S8TO16(b) }
 
+#define RGB8(r, g, b) RGB8_(0x ## r ## ul, 0x ## g ## ul, 0x ## b ## ul)
+
+#define COLOURTAB(n) { \
+       INDIR(RGB8 PASTE(COLOUR ## n, _PRIMARY_RGB_)), \
+       INDIR(RGB8 PASTE(COLOUR ## n, _DARK_RGB_)), \
+       INDIR(RGB8 PASTE(COLOUR ## n, _LIGHT_RGB_)) }
+
 static const XColor colours[7][3] = {
        {
                { 0xffff0000, 0xffff },
                { 0xff00ff00, 0, 0xffff },
                { 0xff0000ff, 0, 0, 0xffff }
        },
-       { RGB8(0x8d,0x2e,0x28), RGB8(0x6a,0x1b,0x17), RGB8(0xa1,0x48,0x42) },
-       { RGB8(0xb4,0x6e,0x28), RGB8(0x92,0x4a,0x16), RGB8(0xc7,0x90,0x4f) },
-       { RGB8(0xd8,0xb7,0x40), RGB8(0xc5,0x9f,0x39), RGB8(0xe2,0xc6,0x5d) },
-       { RGB8(0x28,0x64,0x28), RGB8(0x19,0x47,0x19), RGB8(0x4e,0x87,0x4e) },
-       { RGB8(0x00,0x34,0x71), RGB8(0x00,0x1f,0x4f), RGB8(0x00,0x52,0x8b) },
-       { RGB8(0xdc,0xdc,0xdc), RGB8(0xc0,0xc0,0xc0), RGB8(0xea,0xea,0xea) }
+       COLOURTAB(0), COLOURTAB(1), COLOURTAB(2),
+       COLOURTAB(3), COLOURTAB(4), COLOURTAB(5)
 };
 
 static void print_usage(FILE *f)