From dc35261ed22ca1c7bee50bbfc14887a00e0229dc Mon Sep 17 00:00:00 2001 From: Konrad Date: Sat, 7 Nov 2026 21:16:14 +0000 Subject: [PATCH] splinter: the theme was unreadable, and here is why Two real defects, both measurable: 1. COLORS was read before start_color(), so it was 0 and the colour mapper took the eight-basic-colour branch. Every palette collapsed to white on black - the theme was effectively ignored. 2. A CDE palette is eight mid-tones. Painted literally, Delphinium's accent sat 8% away from the background in luma and its secondary text 14%: readable on a 1995 desktop with a light backdrop, unreadable in a terminal. Fix: the background is darkened (same hue) until its luma is a terminal background, then each role is pushed away from it - foreground 120k, accent 100k, labels 60k in luma units. Delphinium now gives 14:1 for text, 7.7:1 for accent and 4.7:1 for labels on a slate background, with the palette's blues intact. Verified in the escape stream: 38;5;230 text, 38;5;68 and 38;5;74 accents, 48;5;235 surface. sp_color_darken and sp_color_separate live in theme.c so any future consumer gets the same rule, and the deltas are named in one place instead of spread over four init_pair calls. --- README.md | 12 ++++++++++ libsplinter.so | Bin 72416 -> 72504 bytes src/theme.c | 32 +++++++++++++++++++++++++ src/theme.h | 12 ++++++++++ src/ui.c | 63 ++++++++++++++++++++++++++++++++++++++++--------- 5 files changed, 108 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c43fcc1..b39d492 100644 --- a/README.md +++ b/README.md @@ -127,6 +127,18 @@ Both directions are covered by `test_sse`, which feeds recorded lines: plain text, a tool call split across three chunks, two calls in one turn, a broken data line, and the keepalive lines that carry nothing. +## Colour, measured + +A CDE palette is eight mid-tones; painted literally, the accent sat 8% away +from the background and nothing was readable. Two fixes, both in `init_colors`: +the background is darkened until it is a terminal background, and every role is +pushed away from it until it is legible. Delphinium ends up with a white-on-slate +text contrast of 14:1, accents at 7.7:1 and labels at 4.7:1 instead of ~1.1:1. + +The other half was a real bug: `COLORS` was read before `start_color()`, so it +was 0, the code took the eight-basic-colour path, and the whole palette +collapsed to white on black. + ## Screen encoding, measured The vendored NetBSD curses emits Latin-1 bytes for wide characters (`ΓΌ` becomes diff --git a/libsplinter.so b/libsplinter.so index 16e68f17f198ce91a0572f9e61c9f650e4438543..16709d0c2c74c2ea066fb727b45b7d52e35b83ea 100755 GIT binary patch delta 7367 zcmZ8m3s_Xu+TLq~5k_QCKo~E99>jr^i&sc9Mp4H?MKPs6E$|9yg$QY-f+5NXqu?hF zYAP5i8l5owQPW4qJ0TjPCf>2Ewxx!i^DCLh{l9DWnv=DjXYF^b_q(jMzIEAa_B8*m z%f1?yLL+M}3K^s`z9>18@x`Kd!gRkcQft32D%u+6ZVy*$_M*#|+%wv!l?>X?R{KP^ zb^T##!q@k|N)6o9f1~@Ow2b*lG(|Jm_otSkh#cQktz<)?g!Z?wc??z(4%e+%v)~GAmT02OUABo#u70dPJ<$49r@3Y`HVws5 zteMjk-?oYM;v$N1OJb*~%xwXSA@(ps|~xTFRC+zG_ahewHvB43u#1U^{#d!nQnm)+so;R$0VIq zRMWQ6|Fj>f%W_qHMQot0?SpkUg|w=I8rx6maZ*%Uc3|8{0wj0AOIztx&)|+p!igO* z;>m~6JDx9ej2Co_pwlJ##B*$qazQ6;RJC`zs5nkIZTO5HdQQ@H7S*J!G(jJxDXpMS z^vgs3CD`nps?j7Bq;%o5d7Vm}ua5Lu!E_5nFq$jrXosP?A)?ywIq5nE>;5B*TFU69 zjze{;M73}OebRC0OS_%@*{-^DE-VH8<+BklqOnDEp<0*+meLbAmz+)StPb_Ix%$sY zPMX3Xkl_CB>Y9%i%YjB%7f zOt(Wn<)LcE`;b9>LKd)0+7_~dJd7Tc7&?S~R9zhE?fO+j%*-r(O#a(+4c$eaw>dHTqb6%_uh7^1$@EX`<;s4CpxPlOYc+4Ue1j z=A+Rk^sD&toW%za8+|e>_-h4Ka~1{?QipMvtP_101~WSPXht`EjT;(;+L9|)pV54< zM}FZWg)s96beKnMguW(~seOd5I^q$j_jotiQPDSc6kTCzOk$bLO*A9s+)GC}|{ zbW~5svx>=WeQysPs&ST|BkgjSjbhe!>V2`Rlkl)9%CFb{J8y7u*=+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>SdzQ;?xuXMJWA8oh3f<#3fEk#2J=ZbF z#G;JW2Hnis;Fw}!%UOowoC$-(%K-JFWsi9vD^S^F$C^R#o^8-~KgMwmUAEEDe=r;V E|2-i)-~a#s diff --git a/src/theme.c b/src/theme.c index 6048ea6..2ec1bef 100644 --- a/src/theme.c +++ b/src/theme.c @@ -5,6 +5,7 @@ * SPDX-License-Identifier: BSD-3-Clause */ #include +#include #include #include "theme.h" @@ -117,6 +118,37 @@ sp_theme_list(const char ***names, size_t *count) return n; } +void +sp_color_darken(unsigned char c[3], int target) +{ + int guard = 0; + + while (luma(c) > target && guard++ < 40) { + int i; + + for (i = 0; i < 3; i++) + c[i] = (unsigned char)(c[i] * 3 / 4); + } +} + +void +sp_color_separate(unsigned char c[3], const unsigned char ref[3], int min_delta) +{ + int guard = 0; + int up = luma(c) >= luma(ref); + + while (abs(luma(c) - luma(ref)) < min_delta && guard++ < 64) { + int i; + + for (i = 0; i < 3; i++) { + if (up) + c[i] = (unsigned char)(c[i] + (255 - c[i]) / 4 + 1); + else + c[i] = (unsigned char)(c[i] * 3 / 4); + } + } +} + short sp_color_rgb(unsigned char r, unsigned char g, unsigned char b, short colors) { diff --git a/src/theme.h b/src/theme.h index 073edbd..9340755 100644 --- a/src/theme.h +++ b/src/theme.h @@ -40,6 +40,18 @@ int sp_theme_load(const char *name, struct sp_theme *out, struct sp_buf *err); /* List palette names, alphabetical. Returns the number written. */ size_t sp_theme_list(const char ***names, size_t *count); +/* + * Push a colour until it is at least `min_delta` away (in luma) from `ref`, + * toward white or black depending on which side it already is. A palette that + * is all mid-tones is a nice idea on a 1995 desktop and unreadable in a + * terminal; this is the rule that keeps it legible. + */ +/* Scale a colour toward black until its luma is at most `target`. */ +void sp_color_darken(unsigned char c[3], int target); + +void sp_color_separate(unsigned char c[3], const unsigned char ref[3], + int min_delta); + /* Nearest xterm colour index for an RGB triple, for `colors` palette entries. */ short sp_color_rgb(unsigned char r, unsigned char g, unsigned char b, short colors); diff --git a/src/ui.c b/src/ui.c index 86bdd65..8037d7a 100644 --- a/src/ui.c +++ b/src/ui.c @@ -139,25 +139,66 @@ turn_thread(void *arg) return NULL; } +/* + * Colour assignment, and the reasoning behind it: + * + * The terminal background stays the terminal's own (-1). Painting every glyph + * on a palette colour looks like a 1995 desktop and is unreadable in a modern + * terminal - it also fights whatever scheme the user already chose. The palette + * supplies the accents, which is where its character is, and every accent is + * pushed until it is legible against black (the usual terminal background). + */ +/* + * Colour assignment. + * + * Two facts drive this: + * 1. this curses port reports COLORS=256 but does not honour -1 in + * init_pair(), so "terminal default" is not available - every pair needs + * real indices, and a failed init_pair silently leaves white on black; + * 2. a CDE palette is eight mid-tones. Painted literally, the accent sits + * 8% away from the background and nobody can read it. + * + * So the palette paints, and every role is pushed away from the background + * until it is legible: foreground far, accent very far, secondary text at + * least visible. + */ static void init_colors(const struct sp_theme *t) { - short n = (short)(COLORS > 0 ? COLORS : 8); + unsigned char bg[3], fg[3], accent[3], dim[3], status_bg[3]; + short n; if (!has_colors()) return; + /* COLORS is only valid after start_color(); reading it earlier gave 0, + * which silently fell back to the eight basic colours - the whole palette + * collapsed to white on black. */ start_color(); - use_default_colors(); - init_pair(PAIR_MAIN, sp_color_rgb(t->fg[0], t->fg[1], t->fg[2], n), - sp_color_rgb(t->bg[0], t->bg[1], t->bg[2], n)); - init_pair(PAIR_ACCENT, sp_color_rgb(t->accent[0], t->accent[1], - t->accent[2], n), sp_color_rgb(t->bg[0], t->bg[1], t->bg[2], n)); - init_pair(PAIR_DIM, sp_color_rgb(t->border[0], t->border[1], - t->border[2], n), sp_color_rgb(t->bg[0], t->bg[1], t->bg[2], n)); - init_pair(PAIR_STATUS, sp_color_rgb(t->bg[0], t->bg[1], t->bg[2], n), - sp_color_rgb(t->status[0], t->status[1], t->status[2], n)); -} + n = (short)(COLORS > 0 ? COLORS : 8); + memcpy(bg, t->bg, 3); + /* the darkest CDE colour is still a mid-tone: no terminal wants that */ + sp_color_darken(bg, 45000); + memcpy(fg, t->fg, 3); + memcpy(accent, t->accent, 3); + memcpy(dim, t->border, 3); + memcpy(status_bg, t->status, 3); + + sp_color_separate(fg, bg, 120000); /* text */ + sp_color_separate(accent, bg, 100000); /* the user's own lines */ + sp_color_separate(dim, bg, 60000); /* labels: visible, not loud */ + sp_color_darken(status_bg, 60000); /* the bar is a surface, not text */ + + init_pair(PAIR_MAIN, sp_color_rgb(fg[0], fg[1], fg[2], n), + sp_color_rgb(bg[0], bg[1], bg[2], n)); + init_pair(PAIR_ACCENT, sp_color_rgb(accent[0], accent[1], accent[2], n), + sp_color_rgb(bg[0], bg[1], bg[2], n)); + init_pair(PAIR_DIM, sp_color_rgb(dim[0], dim[1], dim[2], n), + sp_color_rgb(bg[0], bg[1], bg[2], n)); + init_pair(PAIR_STATUS, + sp_color_rgb(fg[0], fg[1], fg[2], n), + sp_color_rgb(status_bg[0], status_bg[1], status_bg[2], n)); +} /* * Text goes to curses as ASCII.