Whiteboard: theme-controlled chrome (grid, frame, document scrollbar) ignores the active theme #187
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_whiteboard#187
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
Three pieces of whiteboard chrome are hard-coded to dark-theme colors and never follow the active theme:
Grid dots
static/web/js/whiteboard/canvas.js:138— the grid sceneFunc paints withctx.fillStyle = "#495057". The theme system already definescanvas-grid-colorfor every theme (Dark, Light, Ocean, Warm, Minimal), but the grid never reads it. On Light / Minimal the dark dots clash with the white background.Frame chrome
static/web/js/whiteboard/objects.js:1110, 1120— frames are created withstroke: "#495057"(dashed border) andfill: "#adb5bd"(title label). The theme system already definesframe-strokeandframe-label-colorfor every theme. These hex literals are never themed andapplyThemedoesnt re-paint existing frames.Document scrollbar + placeholder
static/web/js/whiteboard/objects.js:1803, 1839, 1851, 1870, 1871— scrollbar track / thumb / hover and the empty-state placeholder text are hard-coded (#1e293b,#64748b,#94a3b8). No theme tokens exist for these yet.Scope (deliberately narrow)
Fix ONLY chrome that has no user-facing color picker. User-picked colors on sticky / text / shape / drawing / document bg / document border / frame title text / kanban / mindmap stay as the user chose them — those are content, not chrome.
Approach
doc-scrollbar-track,doc-scrollbar-thumb,doc-scrollbar-thumb-hover,doc-placeholder-texttokens to each theme inthemes.js.sceneFuncreadWhiteboardThemes.get("canvas-grid-color")instead of the hex literal.stroke/fillwith the existingframe-stroke/frame-label-colortokens at creation.applyThemeto walk every existing frame and document, re-applying the new chrome colors. The grid is already redrawn viaWhiteboardCanvas.drawGrid()and just needs the sceneFunc fix to take effect.Acceptance
Implementation Spec for Issue #187
Files to Modify
static/web/js/whiteboard/themes.jsstatic/web/js/whiteboard/canvas.jsstatic/web/js/whiteboard/objects.jsImplementation Plan
Step 1: Add document-chrome tokens to every theme
File:
static/web/js/whiteboard/themes.jsAdd the four new tokens to
defaultTheme(Dark) and override per-theme inLight,Ocean,Warm,Minimal. The existingframe-stroke/frame-label-color/canvas-grid-colortokens are already present in every theme — reuse them.Per-theme values:
defaultTheme):doc-scrollbar-track: '#1e293b',doc-scrollbar-thumb: '#64748b',doc-scrollbar-thumb-hover: '#94a3b8',doc-placeholder-text: '#64748b'(preserves today's look).doc-scrollbar-track: '#e5e7eb',doc-scrollbar-thumb: '#9ca3af',doc-scrollbar-thumb-hover: '#6b7280',doc-placeholder-text: '#9ca3af'.doc-scrollbar-track: '#1d3461',doc-scrollbar-thumb: '#8892b0',doc-scrollbar-thumb-hover: '#ccd6f6',doc-placeholder-text: '#8892b0'.doc-scrollbar-track: '#33271d',doc-scrollbar-thumb: '#a08060',doc-scrollbar-thumb-hover: '#e8d5c4',doc-placeholder-text: '#a08060'.doc-scrollbar-track: '#f3f4f6',doc-scrollbar-thumb: '#9ca3af',doc-scrollbar-thumb-hover: '#6b7280',doc-placeholder-text: '#9ca3af'.Step 2: Make the grid sceneFunc read the active token
File:
static/web/js/whiteboard/canvas.js(~line 138)Replace
ctx.fillStyle = '#495057';with:drawGrid()is already invoked byapplyTheme(themes.js:469), so theme switch will re-paint the grid automatically.Step 3: Use theme tokens at frame creation
File:
static/web/js/whiteboard/objects.js(~lines 1108-1124)Replace the hard-coded
stroke: '#495057'andfill: '#adb5bd'with:Step 4: Use theme tokens at document scrollbar + placeholder creation
File:
static/web/js/whiteboard/objects.js:1803placeholderfill:WhiteboardThemes.get('doc-placeholder-text') || '#64748b'.:1839trackfill:WhiteboardThemes.get('doc-scrollbar-track') || '#1e293b'.:1851thumbfill:WhiteboardThemes.get('doc-scrollbar-thumb') || '#64748b'.:1870-1871thumb hover / leave fills: use the hover token / thumb token respectively.Step 5: Extend
applyThemeto repaint existing frames + documentsFile:
static/web/js/whiteboard/themes.js— extend the object-walk inapplyTheme(~lines 474-487).Add branches:
rerenderDocument(objects.js:1882) rebuilds the scrollbar + placeholder from scratch with the new tokens. It also callsWhiteboardSync.onUpdate(group)— which is undesirable for a per-client theme switch (we'd broadcast a same-contentobject.updatedto other users). Guard the call with the_applyingSyncflag, OR callrenderDocumentContentdirectly instead (it's the underlying renderer without the broadcast). The latter is cleaner:If
renderDocumentContentisn't exported, fall back torerenderDocumentand accept the extra broadcast (cheap, idempotent on receivers).After all branches, call
WhiteboardCanvas.getObjectLayer().batchDraw()once.Acceptance Criteria
object.updatedfor the chrome repaint (theme switch stays a client-only preference for chrome).Notes
|| '#495057') soWhiteboardThemes.getreturning undefined at boot doesn't break.Test Results + Final Summary
Changes
static/web/js/whiteboard/themes.js:doc-scrollbar-track,doc-scrollbar-thumb,doc-scrollbar-thumb-hover,doc-placeholder-texttodefaultTheme(Dark) and to Light / Ocean / Warm / Minimal overrides.applyTheme's object walk with two new branches:frame(repaints.bgstroke and.labelfill from the active theme) anddocument(callsrenderDocumentContentto rebuild scrollbar + placeholder).static/web/js/whiteboard/canvas.js:sceneFuncreadsWhiteboardThemes.get('canvas-grid-color')with a hex fallback.static/web/js/whiteboard/objects.js:frame-strokeandframe-label-colortokens.renderDocumentContentsoapplyThemecan rebuild document chrome without going throughrerenderDocument(which would broadcastobject.updated).Behaviour after fix
object.updatedbroadcast — chrome repaint is a per-client preference.Gates
node -c themes.js / canvas.js / objects.js— JS syntax OKcargo fmt --check— passcargo clippy --workspace --all-targets -- -D warnings— passManual verification still required
Rebuild + restart
hero_whiteboard_admin, hard-reload a board with stickies, frames, and documents: