diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-15 18:57:13 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-15 18:57:13 -0500 |
| commit | 242850d6cf0e8a0701c258a97da7c5682d121433 (patch) | |
| tree | 01095ede3031a905750e7c3509a540fc9ff3654d /scripts/theme-studio/palette-actions.js | |
| parent | 626077940d7abed0f684ab55e64492face4fd29e (diff) | |
| download | dotemacs-242850d6cf0e8a0701c258a97da7c5682d121433.tar.gz dotemacs-242850d6cf0e8a0701c258a97da7c5682d121433.zip | |
fix(theme-studio): clamp generated palette spans to the bg/fg bounds
Spanning a color generated steps toward pure black and white, so a column could produce colors darker than bg or lighter than fg. I changed regenColumn to ramp the dark side toward the darker ground endpoint and the light side toward the lighter one, bounded by bg and fg. Pure black/white duplicates are still skipped, and callers that pass no ground fall back to the old black/white ramp.
Node tests cover the bounded span and the no-ground fallback. The #counttest gate asserts the regenerated column stays within the bg/fg bounds.
Diffstat (limited to 'scripts/theme-studio/palette-actions.js')
| -rw-r--r-- | scripts/theme-studio/palette-actions.js | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/theme-studio/palette-actions.js b/scripts/theme-studio/palette-actions.js index e65295bc8..4ea8180bc 100644 --- a/scripts/theme-studio/palette-actions.js +++ b/scripts/theme-studio/palette-actions.js @@ -218,7 +218,7 @@ function columnCountControl(f){ // references and leaving removed ones on their now-gone hex. Returns the removed // count, or null on a bad base. Shared by the count control and the base edit. function regenColumnInPlace(oldHexes,baseHex,baseName,n,columnId){ - const r=regenColumn(baseHex,n,{}); + const r=regenColumn(baseHex,n,{ground:{bg:MAP['bg'],fg:MAP['p']}}); if(r.error){notify('cannot regenerate from '+baseHex,true);return null;} const plan=stepRepointPlan(rankByLightness(oldHexes,baseHex),r.members); const oldSet=new Set(oldHexes.map(h=>h.toLowerCase())); |
