diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-09 19:05:13 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-09 19:05:13 -0500 |
| commit | 843bbf0848adff40714e3d7f01376dfe2f14e1dc (patch) | |
| tree | 9e3e1d8bda06119b137d174617fca8f210b68046 /scripts/theme-studio/generate.py | |
| parent | 1d8b9f9eec00db6c41123475918626fc8721a3bc (diff) | |
| download | dotemacs-843bbf0848adff40714e3d7f01376dfe2f14e1dc.tar.gz dotemacs-843bbf0848adff40714e3d7f01376dfe2f14e1dc.zip | |
feat(theme-studio): mark safe lightness in the OKLCH picker
The OKLCH picker gets a "safe for" selector listing the covered overlay faces. Pick one and the C×L plane shades the lightness band too light to keep that face readable over its foreground set, with the L_max ceiling as the band's lower edge. The ceiling is one marker computed via lMax at the current chroma, not a per-pixel foreground-set mask over the plane, so the existing AA/AAA mask stays single-foreground.
When no foreground is dark enough to fail, the band hides; when even black can't satisfy the target, the whole plane shades. The band only shows in OKLCH mode and clears in HSV. The cursor moved above the band so it stays visible through the shade.
Phase 5 of the palette-ramps spec, the last build phase. A #safetest browser gate pins that the band appears for a selected covered face with a positive height and hides when none is selected.
Diffstat (limited to 'scripts/theme-studio/generate.py')
| -rw-r--r-- | scripts/theme-studio/generate.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/theme-studio/generate.py b/scripts/theme-studio/generate.py index 60520b41..a8cda815 100644 --- a/scripts/theme-studio/generate.py +++ b/scripts/theme-studio/generate.py @@ -465,10 +465,11 @@ STYLES_CSS</style> </div> <div id="picker" class="picker"> <div class="prow"> - <div id="sv" class="sv"><canvas id="svmask" class="svmask"></canvas><div id="svcur" class="svcur"></div></div> + <div id="sv" class="sv"><canvas id="svmask" class="svmask"></canvas><div id="svsafe" class="svsafe" style="display:none"></div><div id="svcur" class="svcur"></div></div> <div id="hue" class="hue"><div id="huecur" class="huecur"></div></div> </div> <div class="pmodel">edit <button data-pm="hsv" class="on">HSV</button><button data-pm="oklch">OKLCH</button></div> + <div class="pmodel" title="in OKLCH mode, shade the lightness too light to keep this overlay face readable over its foreground set">safe for <select id="safefor" onchange="setSafeFace(this.value)"><option value="">none</option></select></div> <div class="oklchctl" id="oklchctl"> <div class="ocrow"><label title="perceptual lightness">L</label><input type="range" id="okL" min="0" max="1" step="0.001"><input type="number" id="okLn" min="0" max="1" step="0.001"></div> <div class="ocrow"><label title="chroma (colorfulness)">C</label><input type="range" id="okC" min="0" max="0.4" step="0.001"><input type="number" id="okCn" min="0" max="0.4" step="0.001"></div> |
