From 47c1df50046d5fe6dcf7b210dcb49142964387e2 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Sat, 13 Jun 2026 19:32:01 -0500 Subject: Shorten theme studio reset erase labels --- scripts/theme-studio/README.md | 17 ++++++++--------- scripts/theme-studio/app.js | 14 +++++++------- scripts/theme-studio/browser-gates.js | 2 +- scripts/theme-studio/theme-studio.html | 24 ++++++++++++------------ scripts/theme-studio/theme-studio.template.html | 8 ++++---- 5 files changed, 32 insertions(+), 33 deletions(-) (limited to 'scripts') diff --git a/scripts/theme-studio/README.md b/scripts/theme-studio/README.md index b680e6a8..c72104bf 100644 --- a/scripts/theme-studio/README.md +++ b/scripts/theme-studio/README.md @@ -105,14 +105,13 @@ Three tiers of faces, plus the palette: function, type, comment, and the rest), each with normal/bold/italic and a contrast rating. Click a category to flash its tokens in the code; click a token to flash its row. `lock all` flips to `unlock all` when every row in the - tier is locked. `reset unlocked` restores unlocked rows to the captured syntax - defaults; `erase unlocked` blanks unlocked rows. Both leave locked rows - untouched. + tier is locked. `reset` restores editable rows to the captured syntax defaults; + `erase` blanks editable rows. Both preserve locked rows. - **UI faces** — cursor, region, mode-line, fringe, line numbers, isearch, paren match, link, error/warning/success, and the rest, foreground and background - per face, shown in a live mock Emacs buffer. `reset unlocked` restores captured - UI face defaults; `erase unlocked` blanks unlocked rows to no explicit fg/bg. - Both leave locked rows untouched. + per face, shown in a live mock Emacs buffer. `reset` restores captured UI face + defaults; `erase` blanks editable rows to no explicit fg/bg. Both preserve + locked rows. - **Package faces** — per-package face tables with a live preview (below). ## Color columns @@ -193,9 +192,9 @@ Pick an application from the dropdown to edit its faces. Each row has a foreground and background dropdown, bold/italic toggles, an `inherit` dropdown (base faces like `fixed-pitch`/`link` plus the app's own faces), a relative height stepper, a contrast readout, and a per-face reset. There's a per-app -reset and a text filter for the large sets. Package `reset unlocked` restores unlocked -rows to the captured package defaults; `erase unlocked` blanks unlocked rows to -no fg/bg/style/inherit override. Both leave locked rows untouched. Package +reset and a text filter for the large sets. Package `reset` restores editable +rows to the captured package defaults; `erase` blanks editable rows to no +fg/bg/style/inherit override. Both preserve locked rows. Package `lock all` / `unlock all` applies to the whole currently selected package, not only the rows visible under the text filter. diff --git a/scripts/theme-studio/app.js b/scripts/theme-studio/app.js index 97d1f076..3e9f2797 100644 --- a/scripts/theme-studio/app.js +++ b/scripts/theme-studio/app.js @@ -110,7 +110,7 @@ function mkStyleButtons(isOn,onToggle){ b.style.fontWeight=at==='bold'?'bold':'normal';b.style.fontStyle=at==='italic'?'italic':'normal'; b.style.textDecoration=at==='underline'?'underline':at==='strike'?'line-through':'none';b.title=at; b.onclick=()=>{onToggle(at);b.classList.toggle('on',!!isOn(at));};return b;});} -// Reset every unlocked row in a tier to its default. keyFn maps a row entry to +// Apply a batch action to every editable row in a tier. keyFn maps a row entry to // its lock key, or null to skip the row entirely (syntax bg and the default fg); // resetFn does the actual clearing. Locked rows are left untouched. function clearUnlockedRows(items,keyFn,resetFn){ @@ -134,25 +134,25 @@ function toggleAllLocks(tier){ } function clearUnlocked(){ clearUnlockedRows(CATS,c=>(c[0]==='bg'||c[0]==='p')?null:c[0],c=>{MAP[c[0]]='';}); - buildTable();renderCode();notify('erased unlocked elements to default',false); + buildTable();renderCode();notify('erased editable syntax elements',false); } function resetUnlocked(){ clearUnlockedRows(CATS,c=>c[0],c=>{const k=c[0];MAP[k]=DEFAULT_MAP[k]||'';BOLD[k]=!!DEFAULT_BOLD[k];ITALIC[k]=!!DEFAULT_ITALIC[k];}); buildTable();buildUITable();buildPkgTable();buildPkgPreview();renderCode();applyGround();repaintCovered(); - notify('reset unlocked syntax elements to captured defaults',false); + notify('reset editable syntax elements to captured defaults',false); } function clearUnlockedUI(){ clearUnlockedRows(UI_FACES,f=>'ui:'+f[0],f=>{UIMAP[f[0]]=uiFaceBlank();}); - buildUITable();buildMockFrame();notify('erased unlocked UI faces to default',false); + buildUITable();buildMockFrame();notify('erased editable UI faces',false); } function resetUnlockedUI(){ clearUnlockedRows(UI_FACES,f=>'ui:'+f[0],f=>{UIMAP[f[0]]=JSON.parse(JSON.stringify(DEFAULT_UIMAP[f[0]]||uiFaceBlank()));}); - buildUITable();buildMockFrame();notify('reset unlocked UI faces to captured defaults',false); + buildUITable();buildMockFrame();notify('reset editable UI faces to captured defaults',false); } function clearUnlockedPkg(){ const app=curApp(); clearUnlockedRows(APPS[app].faces,f=>'pkg:'+app+':'+f[0],f=>{PKGMAP[app][f[0]]=normalizePkgFace({source:'cleared'},'cleared');}); - pkgChanged();notify('erased unlocked '+app+' faces to default',false); + pkgChanged();notify('erased editable '+app+' faces',false); } function buildTable(){ const tb=document.getElementById('legbody');tb.innerHTML=''; @@ -777,7 +777,7 @@ function renderTelegaPreview(){const a='telega',L=[]; return `
${L.join('\n')}
`;} function genericPreview(app){let h='
';for(const [face,label,def] of APPS[app].faces){const f=PKGMAP[app][face],efg=effFg(pkgEffFg(app,face)),ebg=pkgEffBg(app,face);h+=`
${esc(label)}
`;}return h+'
';} function buildPkgPreview(){const app=curApp(),p=document.getElementById('pkgpreview');if(!p)return;const pv=APPS[app].preview;const bespoke=['org','magit','elfeed','ghostel','dashboard','mu4e','lsp','gitgutter','flycheck','dired','dirvish','calibredb','erc','orgdrill','orgnoter','signel','pearl','slack','telega','shr'].includes(pv);p.innerHTML=pv==='org'?renderOrgPreview():pv==='magit'?renderMagitPreview():pv==='elfeed'?renderElfeedPreview():pv==='ghostel'?renderGhostelPreview():pv==='dashboard'?renderDashboardPreview():pv==='mu4e'?renderMu4ePreview():pv==='lsp'?renderLspPreview():pv==='gitgutter'?renderGitGutterPreview():pv==='flycheck'?renderFlycheckPreview():pv==='dired'?renderDiredPreview():pv==='dirvish'?renderDirvishPreview():pv==='calibredb'?renderCalibredbPreview():pv==='erc'?renderErcPreview():pv==='orgdrill'?renderOrgdrillPreview():pv==='orgnoter'?renderOrgnoterPreview():pv==='signel'?renderSignelPreview():pv==='pearl'?renderPearlPreview():pv==='slack'?renderSlackPreview():pv==='telega'?renderTelegaPreview():pv==='shr'?renderShrPreview():genericPreview(app);p.style.background=MAP['bg'];p.onclick=(e)=>{const u=e.target.closest('[data-face]');if(u)flashPkg(u.dataset.face);};const lbl=document.getElementById('pkgprevlabel');if(lbl)lbl.textContent=bespoke?(APPS[app].label+' preview'):'preview (generic — face names in their own colors)';} -function resetApp(){const app=curApp();for(const [face,label,d] of APPS[app].faces)if(!LOCKED.has('pkg:'+app+':'+face))PKGMAP[app][face]=seedFace(d);pkgChanged();notify('reset unlocked '+app+' faces to package defaults',false);} +function resetApp(){const app=curApp();for(const [face,label,d] of APPS[app].faces)if(!LOCKED.has('pkg:'+app+':'+face))PKGMAP[app][face]=seedFace(d);pkgChanged();notify('reset editable '+app+' faces to package defaults',false);} function syncPkgHeight(){const t=document.getElementById('pkgtable'),m=document.getElementById('pkgpreview');if(!t||!m)return;const lb=m.previousElementSibling,lbh=lb?lb.getBoundingClientRect().height+10:30;m.style.height=Math.max(t.getBoundingClientRect().height-lbh,220)+'px';} // --- worst-case readout for the covered overlay faces (spec Phase 4) --------- // Default WCAG target for the worst-case verdict (AA). AAA is selectable. diff --git a/scripts/theme-studio/browser-gates.js b/scripts/theme-studio/browser-gates.js index 6aa5c0b5..d86ec540 100644 --- a/scripts/theme-studio/browser-gates.js +++ b/scripts/theme-studio/browser-gates.js @@ -22,7 +22,7 @@ function pkgSelftest(){ if(location.hash==='#selftest')pkgSelftest(); // Lock-mechanism gate (open with #locktest): two behaviors the refactor must // preserve, across all three tiers. (1) Locking a row disables its controls via -// the shared mkLockCell. (2) reset/erase batch actions update unlocked rows but +// the shared mkLockCell. (2) reset/erase batch actions update editable rows but // leave locked rows (syntax bare-kind, ui:, pkg: keys) untouched. if(location.hash==='#locktest'){let ok=true;const notes=[];const A=(c,n)=>{if(!c){ok=false;notes.push(n);}}; LOCKED.clear();buildTable(); diff --git a/scripts/theme-studio/theme-studio.html b/scripts/theme-studio/theme-studio.html index 7cb5b9c0..4c67faa1 100644 --- a/scripts/theme-studio/theme-studio.html +++ b/scripts/theme-studio/theme-studio.html @@ -153,7 +153,7 @@

code/color assignments

-
+
elements △color △stylecontrastexample
@@ -164,7 +164,7 @@

ui faces

-
+
face △foreground △background △stylecontrast △previewbox
@@ -176,9 +176,9 @@
- + - +
@@ -855,7 +855,7 @@ function mkStyleButtons(isOn,onToggle){ b.style.fontWeight=at==='bold'?'bold':'normal';b.style.fontStyle=at==='italic'?'italic':'normal'; b.style.textDecoration=at==='underline'?'underline':at==='strike'?'line-through':'none';b.title=at; b.onclick=()=>{onToggle(at);b.classList.toggle('on',!!isOn(at));};return b;});} -// Reset every unlocked row in a tier to its default. keyFn maps a row entry to +// Apply a batch action to every editable row in a tier. keyFn maps a row entry to // its lock key, or null to skip the row entirely (syntax bg and the default fg); // resetFn does the actual clearing. Locked rows are left untouched. function clearUnlockedRows(items,keyFn,resetFn){ @@ -879,25 +879,25 @@ function toggleAllLocks(tier){ } function clearUnlocked(){ clearUnlockedRows(CATS,c=>(c[0]==='bg'||c[0]==='p')?null:c[0],c=>{MAP[c[0]]='';}); - buildTable();renderCode();notify('erased unlocked elements to default',false); + buildTable();renderCode();notify('erased editable syntax elements',false); } function resetUnlocked(){ clearUnlockedRows(CATS,c=>c[0],c=>{const k=c[0];MAP[k]=DEFAULT_MAP[k]||'';BOLD[k]=!!DEFAULT_BOLD[k];ITALIC[k]=!!DEFAULT_ITALIC[k];}); buildTable();buildUITable();buildPkgTable();buildPkgPreview();renderCode();applyGround();repaintCovered(); - notify('reset unlocked syntax elements to captured defaults',false); + notify('reset editable syntax elements to captured defaults',false); } function clearUnlockedUI(){ clearUnlockedRows(UI_FACES,f=>'ui:'+f[0],f=>{UIMAP[f[0]]=uiFaceBlank();}); - buildUITable();buildMockFrame();notify('erased unlocked UI faces to default',false); + buildUITable();buildMockFrame();notify('erased editable UI faces',false); } function resetUnlockedUI(){ clearUnlockedRows(UI_FACES,f=>'ui:'+f[0],f=>{UIMAP[f[0]]=JSON.parse(JSON.stringify(DEFAULT_UIMAP[f[0]]||uiFaceBlank()));}); - buildUITable();buildMockFrame();notify('reset unlocked UI faces to captured defaults',false); + buildUITable();buildMockFrame();notify('reset editable UI faces to captured defaults',false); } function clearUnlockedPkg(){ const app=curApp(); clearUnlockedRows(APPS[app].faces,f=>'pkg:'+app+':'+f[0],f=>{PKGMAP[app][f[0]]=normalizePkgFace({source:'cleared'},'cleared');}); - pkgChanged();notify('erased unlocked '+app+' faces to default',false); + pkgChanged();notify('erased editable '+app+' faces',false); } function buildTable(){ const tb=document.getElementById('legbody');tb.innerHTML=''; @@ -1759,7 +1759,7 @@ function renderTelegaPreview(){const a='telega',L=[]; return `
${L.join('\n')}
`;} function genericPreview(app){let h='
';for(const [face,label,def] of APPS[app].faces){const f=PKGMAP[app][face],efg=effFg(pkgEffFg(app,face)),ebg=pkgEffBg(app,face);h+=`
${esc(label)}
`;}return h+'
';} function buildPkgPreview(){const app=curApp(),p=document.getElementById('pkgpreview');if(!p)return;const pv=APPS[app].preview;const bespoke=['org','magit','elfeed','ghostel','dashboard','mu4e','lsp','gitgutter','flycheck','dired','dirvish','calibredb','erc','orgdrill','orgnoter','signel','pearl','slack','telega','shr'].includes(pv);p.innerHTML=pv==='org'?renderOrgPreview():pv==='magit'?renderMagitPreview():pv==='elfeed'?renderElfeedPreview():pv==='ghostel'?renderGhostelPreview():pv==='dashboard'?renderDashboardPreview():pv==='mu4e'?renderMu4ePreview():pv==='lsp'?renderLspPreview():pv==='gitgutter'?renderGitGutterPreview():pv==='flycheck'?renderFlycheckPreview():pv==='dired'?renderDiredPreview():pv==='dirvish'?renderDirvishPreview():pv==='calibredb'?renderCalibredbPreview():pv==='erc'?renderErcPreview():pv==='orgdrill'?renderOrgdrillPreview():pv==='orgnoter'?renderOrgnoterPreview():pv==='signel'?renderSignelPreview():pv==='pearl'?renderPearlPreview():pv==='slack'?renderSlackPreview():pv==='telega'?renderTelegaPreview():pv==='shr'?renderShrPreview():genericPreview(app);p.style.background=MAP['bg'];p.onclick=(e)=>{const u=e.target.closest('[data-face]');if(u)flashPkg(u.dataset.face);};const lbl=document.getElementById('pkgprevlabel');if(lbl)lbl.textContent=bespoke?(APPS[app].label+' preview'):'preview (generic — face names in their own colors)';} -function resetApp(){const app=curApp();for(const [face,label,d] of APPS[app].faces)if(!LOCKED.has('pkg:'+app+':'+face))PKGMAP[app][face]=seedFace(d);pkgChanged();notify('reset unlocked '+app+' faces to package defaults',false);} +function resetApp(){const app=curApp();for(const [face,label,d] of APPS[app].faces)if(!LOCKED.has('pkg:'+app+':'+face))PKGMAP[app][face]=seedFace(d);pkgChanged();notify('reset editable '+app+' faces to package defaults',false);} function syncPkgHeight(){const t=document.getElementById('pkgtable'),m=document.getElementById('pkgpreview');if(!t||!m)return;const lb=m.previousElementSibling,lbh=lb?lb.getBoundingClientRect().height+10:30;m.style.height=Math.max(t.getBoundingClientRect().height-lbh,220)+'px';} // --- worst-case readout for the covered overlay faces (spec Phase 4) --------- // Default WCAG target for the worst-case verdict (AA). AAA is selectable. @@ -1841,7 +1841,7 @@ function pkgSelftest(){ if(location.hash==='#selftest')pkgSelftest(); // Lock-mechanism gate (open with #locktest): two behaviors the refactor must // preserve, across all three tiers. (1) Locking a row disables its controls via -// the shared mkLockCell. (2) reset/erase batch actions update unlocked rows but +// the shared mkLockCell. (2) reset/erase batch actions update editable rows but // leave locked rows (syntax bare-kind, ui:, pkg: keys) untouched. if(location.hash==='#locktest'){let ok=true;const notes=[];const A=(c,n)=>{if(!c){ok=false;notes.push(n);}}; LOCKED.clear();buildTable(); diff --git a/scripts/theme-studio/theme-studio.template.html b/scripts/theme-studio/theme-studio.template.html index b0e26e2c..99bad35e 100644 --- a/scripts/theme-studio/theme-studio.template.html +++ b/scripts/theme-studio/theme-studio.template.html @@ -48,7 +48,7 @@ STYLES_CSS

code/color assignments

-
+
elements △color △stylecontrastexample
@@ -59,7 +59,7 @@ STYLES_CSS

ui faces

-
+
face △foreground △background △stylecontrast △previewbox
@@ -71,9 +71,9 @@ STYLES_CSS
- + - +
-- cgit v1.2.3