aboutsummaryrefslogtreecommitdiff
path: root/scripts/theme-studio/app.js
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-06-13 18:03:03 -0500
committerCraig Jennings <c@cjennings.net>2026-06-13 18:03:03 -0500
commit0495b16fb940e0f573d4655f0a392d5159bcdeff (patch)
treef1ba16c4ceab71f1823f2cc1cff915a1c99d7905 /scripts/theme-studio/app.js
parent237ab428f5f2c719f4c6cf2624c7e223c16945e6 (diff)
downloaddotemacs-0495b16fb940e0f573d4655f0a392d5159bcdeff.tar.gz
dotemacs-0495b16fb940e0f573d4655f0a392d5159bcdeff.zip
Fix theme studio ground endpoint edit
Diffstat (limited to 'scripts/theme-studio/app.js')
-rw-r--r--scripts/theme-studio/app.js7
1 files changed, 4 insertions, 3 deletions
diff --git a/scripts/theme-studio/app.js b/scripts/theme-studio/app.js
index 7f674a24..3c4df190 100644
--- a/scripts/theme-studio/app.js
+++ b/scripts/theme-studio/app.js
@@ -166,14 +166,15 @@ function updateColor(){
const newHex=curHex();
const newName=(document.getElementById('newname').value.trim())||PALETTE[i][1];
if(PALETTE.some((p,j)=>j!==i&&p[1].toLowerCase()===newName.toLowerCase())){notify('another color is already named "'+newName+'" — names must be unique',true);return;}
+ const isGroundEdit=oldRole==='bg'||oldRole==='fg';
// If the edited color is a column base with a ramp, recolor the whole column: regenerate from the new base at the same count.
const columns=columnsFromPalette(PALETTE,{bg:MAP['bg'],fg:MAP['p']}).columns;
- const column=columns.find(f=>f.base.toLowerCase()===oldHex.toLowerCase());
+ const column=isGroundEdit?null:columns.find(f=>f.base.toLowerCase()===oldHex.toLowerCase());
const count=column?Math.max(0,...rankByLightness(column.members.map(m=>m.hex),column.base).map(m=>Math.abs(m.offset))):0;
- const columnId=PALETTE[i][2]||columnStem(PALETTE[i][1]);
+ const columnId=isGroundEdit?'ground':(PALETTE[i][2]||columnStem(PALETTE[i][1]));
PALETTE[i]=[newHex,newName,columnId];
const duplicateOldHex=PALETTE.some((p,j)=>j!==i&&p[0].toLowerCase()===oldHex.toLowerCase());
- if(oldRole==='bg'||oldRole==='fg')repointHex(oldHex,newHex);
+ if(isGroundEdit)repointHex(oldHex,newHex);
else if(!duplicateOldHex&&oldHex!==MAP['bg']&&oldHex!==MAP['p'])repointHex(oldHex,newHex);
if(column&&count>0){
const oldHexes=column.members.map(m=>m.hex.toLowerCase()===oldHex.toLowerCase()?newHex:m.hex);