aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/test_generate.py
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-09 18:53:05 -0500
committerCraig Jennings <c@cjennings.net>2026-06-09 18:53:05 -0500
commite7021bfe47072d8d9cb0fa6ec8d240d877f13cf0 (patch)
tree94d204fbef670f8a180cf63679419c03525a8119 /scripts/theme-studio/test_generate.py
parent47cf3552bf1151aed99477653dacd14993f3c736 (diff)
downloaddotemacs-e7021bfe47072d8d9cb0fa6ec8d240d877f13cf0.tar.gz
dotemacs-e7021bfe47072d8d9cb0fa6ec8d240d877f13cf0.zip
feat(theme-studio): add the background-contrast safety core
A background overlay sits behind many foregrounds at once, so its real constraint is the worst-case contrast over the whole set, not the single fg/bg pair the contrast cell shows today. Phase 3 adds three pure functions in app-core.js for that. fgSetFor(face, state) builds a covered face's foreground set: the distinct syntax-token colors plus the default foreground, each labeled by syntax role. It returns a structured reason ('out-of-scope' or 'empty') rather than a bogus set when the face isn't covered or has no syntax assignments. floor(bgHex, fgSet) returns the minimum WCAG contrast over that set with the limiting foreground's hex and label. lMax(hue, chroma, fgSet, target) finds the lightest background that still clears the target, scanning L up from black to bracket the dark-side crossing then binary-searching it, and reports status ok/none/all/clamp. state is passed explicitly (covered set, syntax assignments, default fg) so the functions read no globals and the Node tests stay direct. The closed five-face covered set lives here as COVERED_FACES, shared with app.js. Tests include the sterling keyword-blue worst case as a fixture, plus lMax's none/all/clamp branches.
Diffstat (limited to 'scripts/theme-studio/test_generate.py')
0 files changed, 0 insertions, 0 deletions