aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-05-06 10:37:22 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-05-06 10:39:30 +0000
commita720188b42051b24248d40024625f311eedd5c6c (patch)
tree8bcc62d4cb674d4ee8606c6538809c8fab9d0485
parentdoc: foot.ini: update max-shm-pool-size-mb section (diff)
config: fix color cube generation
Closes #479
-rw-r--r--CHANGELOG.md2
-rw-r--r--config.c11
2 files changed, 10 insertions, 3 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 73ae227e..e719e83d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -70,6 +70,8 @@
* `generate-alt-random-writes.py --sixel` sometimes crashing,
resulting in PGO build failures.
+* Wrong colors in the 256-color cube
+ (https://codeberg.org/dnkl/foot/issues/479).
### Security
diff --git a/config.c b/config.c
index f5446107..59534ec9 100644
--- a/config.c
+++ b/config.c
@@ -2318,15 +2318,20 @@ config_load(struct config *conf, const char *conf_path,
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]
- = r * 51 << 16 | g * 51 << 8 | b * 51;
+ = red << 16 | green << 8 | blue << 0;
}
}
}
/* And finally 24 shades of gray */
- for (size_t i = 0; i < 24; i++)
- conf->colors.table[232 + i] = i * 11 << 16 | i * 11 << 8 | i * 11;
+ 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;
+ }
}
conf->notify.raw_cmd = xstrdup(