aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/app.js
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-09 19:23:05 -0500
committerCraig Jennings <c@cjennings.net>2026-06-09 19:23:05 -0500
commit7d69d4df0086a408a52c85aedf1516eef18a1dce (patch)
tree62151e90961fd0e7ac5fff449822b56da1283567 /scripts/theme-studio/app.js
parentdb67b9a482144a98bca0f6c70154daefc936dcb0 (diff)
downloaddotemacs-7d69d4df0086a408a52c85aedf1516eef18a1dce.tar.gz
dotemacs-7d69d4df0086a408a52c85aedf1516eef18a1dce.zip
feat(theme-studio): show the hex under each ramp preview tile
Each ramp step tile showed only its derived name. It now shows the hex underneath too, matching the palette chips, so you can read the generated value without hovering for the title. The #ramptest gate asserts every tile carries its hex line.
Diffstat (limited to 'scripts/theme-studio/app.js')
-rw-r--r--scripts/theme-studio/app.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/scripts/theme-studio/app.js b/scripts/theme-studio/app.js
index dc5b44bd..ff6d7c47 100644
--- a/scripts/theme-studio/app.js
+++ b/scripts/theme-studio/app.js
@@ -309,7 +309,7 @@ function renderRamp(){
rampNote(r.adjusted.length?('adjusted: '+r.adjusted.join(', ')):'',false);
r.steps.forEach(s=>{const nm=rampStepName(s.offset);const c=document.createElement('div');c.className='rchip';c.style.background=s.hex;c.style.color=textOn(s.hex);
c.title=nm+' '+s.hex+(s.clamped?' (gamut-clamped)':'');
- c.innerHTML=`<span>${esc(nm)}</span>${s.clamped?'<span class="rclamp" title="clamped to sRGB">!</span>':''}`;
+ c.innerHTML=`<span>${esc(nm)}</span><span class="rhex">${s.hex}</span>${s.clamped?'<span class="rclamp" title="clamped to sRGB">!</span>':''}`;
c.onclick=()=>addRampStep(s);prev.appendChild(c);});
}
// Insert a step adjacent to the source swatch, keeping the ramp siblings in
@@ -1012,6 +1012,7 @@ if(location.hash==='#ramptest'){let ok=true;const notes=[];const A=(c,n)=>{if(!c
selectedIdx=PALETTE.findIndex(p=>p[1]==='blue');document.getElementById('newhexstr').value='#67809c';document.getElementById('newname').value='blue';
openRamp();document.getElementById('rampn').value='2';document.getElementById('rampstepl').value='0.08';document.getElementById('rampce').value='0.5';renderRamp();
A(document.querySelectorAll('#rampprev .rchip').length===4,'expected 4 step chips, got '+document.querySelectorAll('#rampprev .rchip').length);
+ A(document.querySelectorAll('#rampprev .rchip .rhex').length===4,'each step tile shows its hex');
addAllRampSteps();
const names=PALETTE.map(p=>p[1]),bi=names.indexOf('blue');
A(names.slice(bi,bi+5).join(',')==='blue,blue-2,blue-1,blue+1,blue+2','order after blue: '+names.slice(bi,bi+5).join(','));