Skip to content

Commit 652d808

Browse files
vagkaratzasclaude
andcommitted
fix(ui): keep theme floor color on layer hover-exit
applyTheme set layer colors via repaintLayers(theme.floor) but never updated the #floor_color input, which is the source of truth on the picker priority path. Hover-exit repaint (repaintLayers() / Layer.getColor()) read the stale input and reverted layers to the dark default. Restore the v2 behaviour of writing the theme floor into #floor_color. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 19789a8 commit 652d808

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

frontend/e2e/themes.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ test('theme buttons attach on load and switch scene theme (undoable)', async ({
3030

3131
await page.locator('#lightThemeButton').click()
3232
expect(await page.evaluate(edgeColor())).toBe('#5c5c5c')
33+
// Regression: floor_color input is the picker-path source of truth, so a
34+
// theme toggle must update it — otherwise hover-exit repaint reverts layers
35+
// to the stale (dark) color.
36+
await expect(page.locator('#floor_color')).toHaveValue('#8aa185')
3337

3438
await page.locator('#grayThemeButton').click()
3539
expect(await page.evaluate(edgeColor())).toBe('#6e2a5a')

frontend/src/actions/themes.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,14 @@ export function applyTheme(name: string, fromInit = false): void {
6363

6464
if (!fromInit) {
6565
// v2 repaintLayersFromPicker: switch layers to picker priority with the
66-
// theme's floor color
66+
// theme's floor color. The floor_color input is the source of truth on the
67+
// picker path (repaintLayers()/Layer.getColor() read it on hover-exit), so
68+
// update it too — otherwise hover-exit reverts to the stale (dark) color.
6769
ctx.layerColorPrioritySource = 'picker'
70+
const floorInput =
71+
typeof document !== 'undefined' &&
72+
(document.getElementById('floor_color') as HTMLInputElement | null)
73+
if (floorInput) floorInput.value = theme.floor
6874
repaintLayers(theme.floor)
6975
redrawIntraLayerEdges()
7076
ctx.renderInterLayerEdgesFlag = true

0 commit comments

Comments
 (0)