aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-09-26 11:30:56 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-09-26 11:30:56 +0000
commitdf8aea6cb66b3d72bcf9ea0b76653327940d6a72 (patch)
tree0056c1b90fe5b86f206fc942debd1c4a41a38b19
parentMerge branch 'non-dpi-aware-if-any-output-uses-scaling' (diff)
parentconfig: add comments to default_color_table[] about color channel values (diff)
Merge branch 'static-color-table'
-rw-r--r--config.c79
1 files changed, 33 insertions, 46 deletions
diff --git a/config.c b/config.c
index 4241060d..e3b79e3e 100644
--- a/config.c
+++ b/config.c
@@ -31,7 +31,19 @@
static const uint32_t default_foreground = 0xdcdccc;
static const uint32_t default_background = 0x111111;
-static const uint32_t default_regular[] = {
+#define cube6(r, g) \
+ r|g|0x00, r|g|0x5f, r|g|0x87, r|g|0xaf, r|g|0xd7, r|g|0xff
+
+#define cube36(r) \
+ cube6(r, 0x0000), \
+ cube6(r, 0x5f00), \
+ cube6(r, 0x8700), \
+ cube6(r, 0xaf00), \
+ cube6(r, 0xd700), \
+ cube6(r, 0xff00)
+
+static const uint32_t default_color_table[256] = {
+ // Regular
0x222222,
0xcc9393,
0x7f9f7f,
@@ -40,9 +52,8 @@ static const uint32_t default_regular[] = {
0xdc8cc3,
0x93e0e3,
0xdcdccc,
-};
-static const uint32_t default_bright[] = {
+ // Bright
0x666666,
0xdca3a3,
0xbfebbf,
@@ -51,6 +62,24 @@ static const uint32_t default_bright[] = {
0xfcace3,
0xb3ffff,
0xffffff,
+
+ // 6x6x6 RGB cube
+ // (color channels = i ? i*40+55 : 0, where i = 0..5)
+ cube36(0x000000),
+ cube36(0x5f0000),
+ cube36(0x870000),
+ cube36(0xaf0000),
+ cube36(0xd70000),
+ cube36(0xff0000),
+
+ // 24 shades of gray
+ // (color channels = i*10+8, where i = 0..23)
+ 0x080808, 0x121212, 0x1c1c1c, 0x262626,
+ 0x303030, 0x3a3a3a, 0x444444, 0x4e4e4e,
+ 0x585858, 0x626262, 0x6c6c6c, 0x767676,
+ 0x808080, 0x8a8a8a, 0x949494, 0x9e9e9e,
+ 0xa8a8a8, 0xb2b2b2, 0xbcbcbc, 0xc6c6c6,
+ 0xd0d0d0, 0xdadada, 0xe4e4e4, 0xeeeeee
};
static const char *const binding_action_map[] = {
@@ -2887,25 +2916,6 @@ config_load(struct config *conf, const char *conf_path,
.colors = {
.fg = default_foreground,
.bg = default_background,
- .table = {
- default_regular[0],
- default_regular[1],
- default_regular[2],
- default_regular[3],
- default_regular[4],
- default_regular[5],
- default_regular[6],
- default_regular[7],
-
- default_bright[0],
- default_bright[1],
- default_bright[2],
- default_bright[3],
- default_bright[4],
- default_bright[5],
- default_bright[6],
- default_bright[7],
- },
.alpha = 0xffff,
.selection_fg = 0x80000000, /* Use default bg */
.selection_bg = 0x80000000, /* Use default fg */
@@ -2966,30 +2976,7 @@ config_load(struct config *conf, const char *conf_path,
.notifications = tll_init(),
};
- /* Initialize the color cube */
- {
- /* First 16 entries correspond to the "regular" and "bright"
- * colors, and have already been initialized */
-
- /* Then follows 216 RGB shades */
- for (size_t r = 0; r < 6; r++) {
- for (size_t g = 0; g < 6; g++) {
- for (size_t b = 0; b < 6; b++) {
- uint8_t red = r ? r * 40 + 55 : 0;
- uint8_t green = g ? g * 40 + 55 : 0;
- uint8_t blue = b ? b * 40 + 55 : 0;
- conf->colors.table[16 + r * 6 * 6 + g * 6 + b]
- = red << 16 | green << 8 | blue << 0;
- }
- }
- }
-
- /* And finally 24 shades of gray */
- for (size_t i = 0; i < 24; i++) {
- uint8_t level = i * 10 + 8;
- conf->colors.table[232 + i] = level << 16 | level << 8 | level << 0;
- }
- }
+ memcpy(conf->colors.table, default_color_table, sizeof(default_color_table));
tokenize_cmdline("notify-send -a ${app-id} -i ${app-id} ${title} ${body}",
&conf->notify.argv.args);