diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-14 21:59:09 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-14 21:59:28 -0500 |
| commit | 4c4a10da4ea4d5536bcc27d70cdccdec58e48060 (patch) | |
| tree | 540b230e4d7c7f84160359315289d2dbf15f64b3 /scripts/theme-studio/theme-studio.html | |
| parent | 318b1bb4c2c4e8bdc1f29158629d8637146636de (diff) | |
| download | dotemacs-4c4a10da4ea4d5536bcc27d70cdccdec58e48060.tar.gz dotemacs-4c4a10da4ea4d5536bcc27d70cdccdec58e48060.zip | |
chore(theme-studio): remove dead code and clear a type warning
- ramp (app-core.js) and its test-ramp.mjs: superseded by regenColumn, no production caller.
- optList (app-core.js) and its tests: superseded by paletteOptionList.
- ITALIC in generate.py: computed, never read (ITALIC_MAP is the live one).
- a stray empty string in MU4E_FACES that .split() silently dropped.
- the dead #familytest alias in the columntest gate, which HASHES never listed.
- widen face_rows to Sequence[str], clearing the list-invariance warnings on the APPS calls.
Diffstat (limited to 'scripts/theme-studio/theme-studio.html')
| -rw-r--r-- | scripts/theme-studio/theme-studio.html | 38 |
1 files changed, 1 insertions, 37 deletions
diff --git a/scripts/theme-studio/theme-studio.html b/scripts/theme-studio/theme-studio.html index 5fb563863..0c7f28cc3 100644 --- a/scripts/theme-studio/theme-studio.html +++ b/scripts/theme-studio/theme-studio.html @@ -573,46 +573,10 @@ function dropdownRowTextColor(hex,shown,textOnFn){ return shown?textOnFn(shown):''; } -// Standard swatch-dropdown option list: a default entry, then the palette. When -// cur is set but no longer in the palette, surface it as a "(gone)" entry first. -function optList(cur,palette){const have=cur===''||palette.some(p=>p[0]===cur);return [['','— default —'],...(have?palette:[[cur,'(gone)'],...palette])];} - // Turn a theme name into a safe filename slug: collapse runs of disallowed // characters to a single dash, trim leading/trailing dashes, fall back to 'theme'. function slugify(name){return name.replace(/[^A-Za-z0-9._-]+/g,'-').replace(/^-+|-+$/g,'')||'theme';} -// Generate a tonal ramp from one base color: 2n steps at offsets -n..-1 and -// +1..+n (the base itself is excluded — it already lives in the palette), -// ordered darkest -> lightest. Holds the OKLCH hue, steps lightness by stepL per -// stop, and eases chroma toward the extremes (quadratic in |offset|/n, so only -// the farthest step loses most of its color). Every step is gamut-clamped and -// carries its own clamped flag. Returns {steps:[{hex,clamped,offset}], adjusted} -// where adjusted names any knob clamped/rounded into range, or {steps:[], -// error:'bad-hex'} for an unparseable base. Pure — opts are clamped, never thrown. -function ramp(baseHex,opts){ - const hex=typeof baseHex==='string'?normHex(baseHex):null; - if(!hex)return {steps:[],error:'bad-hex'}; - const o=opts||{},adjusted=[]; - const knob=(name,def,lo,hi,isInt)=>{ - const v=o[name]; - if(typeof v!=='number'||!isFinite(v))return def; - const r=isInt?Math.round(v):v,c=Math.min(hi,Math.max(lo,r)); - if(c!==v)adjusted.push(name); - return c; - }; - const n=knob('n',2,1,4,true),stepL=knob('stepL',0.08,0.04,0.12,false),chromaEase=knob('chromaEase',0.5,0,1,false); - const {L:L0,C:C0,H:H0}=oklab2oklch(srgb2oklab(hex)); - const steps=[]; - for(let off=-n;off<=n;off++){ - if(off===0)continue; - const L=Math.min(1,Math.max(0,L0+off*stepL)); - const t=Math.abs(off)/n,C=C0*(1-chromaEase*t*t); - const {hex:h,clamped}=oklch2hex(L,C,H0); - steps.push({hex:h,clamped,offset:off}); - } - return {steps,adjusted}; -} - // --- background-contrast safety (palette-ramps spec, Phase 3) ---------------- // An overlay background sits behind many foregrounds at once, so its real // constraint is the worst-case contrast over the whole set, not one fg/bg pair. @@ -2933,7 +2897,7 @@ if(location.hash==='#healtest'){let ok=true;const notes=[];const A=(c,n)=>{if(!c // Column-strip gate (open with #columntest): the palette renders as a pinned // ground column plus structural columns, chips keep their controls, and renaming // a color leaves it in the same strip because the column id is stable. -if(location.hash==='#columntest'||location.hash==='#familytest'){let ok=true;const notes=[];const A=(c,n)=>{if(!c){ok=false;notes.push(n);}}; +if(location.hash==='#columntest'){let ok=true;const notes=[];const A=(c,n)=>{if(!c){ok=false;notes.push(n);}}; const saveP=PALETTE.slice(),saveM=Object.assign({},MAP),saveG=Object.assign({},lastGone),saveSel=selectedIdx; setSyntaxFg('bg','#0d0b0a');setSyntaxFg('p','#f0fef0'); PALETTE=[['#0d0b0a','ground'],['#f0fef0','fg'],['#c0402a','red'],['#3a6ea5','blue'],['#808080','gray']];selectedIdx=null;renderPalette(); |
