aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoranabasis <anabasis@noreply.codeberg.org>2024-05-11 23:27:07 -0400
committeranabasis <anabasis@noreply.codeberg.org>2024-05-11 23:27:07 -0400
commitf0baa70529ecee8761dc7efed572fdcbedc6c57d (patch)
tree2cc71ff7bdc406215dc6dc83e56cb8175aefa776
parenta30bb0398a468f3f59438dd441165953e9d6c0dd (diff)
downloaddwlb-f0baa70529ecee8761dc7efed572fdcbedc6c57d.tar.gz
add macro for hex code colors
-rw-r--r--config.def.h29
1 files changed, 17 insertions, 12 deletions
diff --git a/config.def.h b/config.def.h
index 017258e..7eee538 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,3 +1,9 @@
+#define HEX_COLOR(hex) \
+ { .red = ((hex >> 24) & 0xff) * 257, \
+ .green = ((hex >> 16) & 0xff) * 257, \
+ .blue = ((hex >> 8) & 0xff) * 257, \
+ .alpha = (hex & 0xff) * 257 }
+
// use ipc functionality
static bool ipc = false;
// initially hide all bars
@@ -22,15 +28,14 @@ static char *fontstr = "monospace:size=16";
static char *tags_names[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
// set 16-bit colors for bar
-// 8-bit color can be converted to 16-bit color by simply duplicating values e.g
-// 0x55 -> 0x5555, 0xf1 -> 0xf1f1
-static pixman_color_t active_fg_color = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
-static pixman_color_t active_bg_color = { .red = 0x0000, .green = 0x5555, .blue = 0x7777, .alpha = 0xffff, };
-static pixman_color_t occupied_fg_color = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
-static pixman_color_t occupied_bg_color = { .red = 0x0000, .green = 0x5555, .blue = 0x7777, .alpha = 0xffff, };
-static pixman_color_t inactive_fg_color = { .red = 0xbbbb, .green = 0xbbbb, .blue = 0xbbbb, .alpha = 0xffff, };
-static pixman_color_t inactive_bg_color = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
-static pixman_color_t urgent_fg_color = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
-static pixman_color_t urgent_bg_color = { .red = 0xeeee, .green = 0xeeee, .blue = 0xeeee, .alpha = 0xffff, };
-static pixman_color_t middle_bg_color = { .red = 0x2222, .green = 0x2222, .blue = 0x2222, .alpha = 0xffff, };
-static pixman_color_t middle_bg_color_selected = { .red = 0x0000, .green = 0x5555, .blue = 0x7777, .alpha = 0xffff, };
+// use either pixman_color_t struct or HEX_COLOR macro for 8-bit colors
+static pixman_color_t active_fg_color = HEX_COLOR(0xeeeeeeff);
+static pixman_color_t active_bg_color = HEX_COLOR(0x005577ff);
+static pixman_color_t occupied_fg_color = HEX_COLOR(0xeeeeeeff);
+static pixman_color_t occupied_bg_color = HEX_COLOR(0x005577ff);
+static pixman_color_t inactive_fg_color = HEX_COLOR(0xbbbbbbff);
+static pixman_color_t inactive_bg_color = HEX_COLOR(0x222222ff);
+static pixman_color_t urgent_fg_color = HEX_COLOR(0x222222ff);
+static pixman_color_t urgent_bg_color = HEX_COLOR(0xeeeeeeff);
+static pixman_color_t middle_bg_color = HEX_COLOR(0x222222ff);
+static pixman_color_t middle_bg_color_selected = HEX_COLOR(0x005577ff);