Theme: kanban, mindmap, connectors, sticky palette ignore the active theme #116
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#116
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?
Summary
After #115 the chrome (navbar / toolbar / properties / zoom / minimap) follows the active theme, and
calendar.jswas already wired toWhiteboardThemes.get(...). But several object types still paint themselves with hard-coded colors, so a Light or Ocean board still has dark-grey kanban columns, dark-grey mindmap nodes, etc.Affected object types
#212529(board bg),#2b3035(column / card bg),#dee2e6(title),#3b3b5c/#495057(borders),#888/#555/#666(labels / icons),#007AFF(selected). The theme already exposeskanban-bg / kanban-column-bg / kanban-card-bg / kanban-card-border / kanban-text-color / kanban-title-color— kanban.js just doesn’t read them.#2b3035, text#dee2e6/#fff, link stroke#555, comment editor#1a1d21/#495057/#a78bfa/#007AFF. Nomindmap-*tokens exist on the theme dict yet.connectors.jsdefaults stroke to#007AFFliterally instead of readingconnector-strokefrom the theme.objects.jshard-codes the sticky color palette (STICKY_COLORS) and the default text/shape fills (#dee2e6,#1a1a1a) even though the theme already definessticky-colors,text-color,shape-text-color,shape-stroke, etc.Steps to reproduce
Expected
Each new object renders in the theme’s palette. Switching theme also re-paints existing objects of these types.
Actual
Kanban / mindmap render in the Dark palette regardless of theme. Connector defaults stay the same
#007AFFblue across all themes. Sticky palette is identical regardless of theme.Approach
Two-part fix:
WhiteboardThemes.get(...)and re-render the affected objects fromapplyThemethe same way calendar does today.mindmap-*tokens todefaultThemeand each built-in (and the existing custom themes), then makemindmap.jsread them. Mindmap nodes / link / text / comment-editor get a dedicated mini-palette per theme.The "re-paint on theme change" hook is already wired for calendars in
themes.js::applyTheme; we extend the same loop to walk all kanbans / mindmaps / connectors and call their respectiveredrawhelpers (kanban + mindmap already expose redraw functions; connectors will need a smallapplyThemehelper that walks the connector layer).Implementation Spec for Issue #116
Objective
Make kanban, mindmap, connectors, and the sticky/text/shape defaults follow the active theme. Today only the canvas, the chrome (after #115), and calendars (always) follow the theme; everything else is hard-coded to the Dark palette.
Files to Modify
crates/hero_whiteboard_ui/static/web/js/whiteboard/themes.js— extenddefaultThemeand the four built-ins withmindmap-*tokens; extendapplyTheme's redraw loop to cover kanban / mindmap / connectors.crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.js— replace hard-coded chrome colors withWhiteboardThemes.get('kanban-*').crates/hero_whiteboard_ui/static/web/js/whiteboard/mindmap.js— replace hard-coded node / link / text / comment-editor colors with newmindmap-*theme reads.crates/hero_whiteboard_ui/static/web/js/whiteboard/connectors.js— default new-connector stroke fromconnector-stroke; expose anapplyTheme()helper that recolors any default-stroke connectors when the theme switches.crates/hero_whiteboard_ui/static/web/js/whiteboard/objects.js— sticky color palette fromsticky-colors; default text and shape stroke/text fills fromtext-color/shape-stroke/shape-text-color.Implementation Plan
Step 1: themes.js — add mindmap tokens + redraw loop
File:
crates/hero_whiteboard_ui/static/web/js/whiteboard/themes.jsdefaultTheme:kanban-*shades where the meaning matches.)applyTheme's post-canvas section, expand the existing calendar redraw loop so the same iteration also callsWhiteboardKanban.redraw(group)for eachtype === 'kanban', andWhiteboardMindmap.redraw(group)for eachtype === 'mindmap'.WhiteboardConnectors.applyTheme()(added in step 4 below) to recolor any connector that was using the default stroke.Dependencies: none.
Step 2: kanban.js — read theme tokens
File:
crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.jsReplace literal colors in
renderKanbanandrenderColumnwithWhiteboardThemes.get('kanban-*'):#212529(board bg)kanban-bg#3b3b5c(board border),#495057(card border, also selected stroke baseline)kanban-card-border#2b3035(column bg, card bg)kanban-column-bg/kanban-card-bg#dee2e6(column title)kanban-text-color#888(board label),#555(delete-col idle / "+ Column"),#666(add-card idle)kanban-title-colorSelection / hover accents (
#007AFF,#dc3545for delete hover) stay as-is — those are functional state colors, not theme surfaces.COL_COLORS(the per-column accent palette) stays hard-coded since it conveys per-column identity, not chrome.Dependencies: Step 1 (so
applyThemetriggers a redraw on theme change).Step 3: mindmap.js — read mindmap-* tokens
File:
crates/hero_whiteboard_ui/static/web/js/whiteboard/mindmap.jsReplace literal colors in
renderMindmapand the comment-popup builder:#2b3035(non-root node fill)mindmap-node-bg#dee2e6(non-root node text)mindmap-node-text#fff(root node text)mindmap-node-text-root#555(link default),#888/#666(placeholder text)mindmap-link-stroke/mindmap-placeholder-text#1a1d21(comment textarea bg),#495057(border),#e0e0e0(text),#a78bfa(header accent)mindmap-comment-bg / -border / -text / -accentPer-node user-chosen colors (
tree.color,child.node.color) stay as-is — those are content, not chrome.Dependencies: Step 1.
Step 4: connectors.js — theme default + applyTheme helper
File:
crates/hero_whiteboard_ui/static/web/js/whiteboard/connectors.js'#007AFF'literals at create time withWhiteboardThemes.get('connector-stroke')._themeDefault: trueif they were created without an explicit stroke override (so we can recolor them on theme change without clobbering user-chosen colors).function applyTheme()to the public API that walks the connector layer and re-appliesconnector-stroketo every connector flagged_themeDefault.Dependencies: none. (Step 1 will call
applyThemeon theme switch.)Step 5: objects.js — sticky palette + shape defaults
File:
crates/hero_whiteboard_ui/static/web/js/whiteboard/objects.jsSTICKY_COLORSconstant with a getter that returnsWhiteboardThemes.get('sticky-colors')at call time (so theme switches see the new palette immediately for new stickies; existing stickies keep their chosen color).#dee2e6withWhiteboardThemes.get('text-color').#007AFFand shape-text#dee2e6withWhiteboardThemes.get('shape-stroke')/WhiteboardThemes.get('shape-text-color')at create time.Existing objects already store their resolved color, so theme switches don't retroactively repaint them — that's intentional, since users may have customized individual objects.
Dependencies: none.
Acceptance Criteria
kanban-*palette (board, columns, cards, titles, labels).mindmap-*palette (node, link, text, comment popup).connector-strokeinstead of a hard-coded blue.cargo fmt,cargo clippy --workspace --all-targets -- -D warnings,cargo test --workspace --libclean.Notes
mindmap-*keeps the override surface explicit._themeDefaultflag — without it, recoloring on theme switch would erase user-customized colors. The flag is set only when a connector is created without explicitopts.stroke, so user-customized ones stay untouched.applyThemealready broadcasts viaboard.theme.updated, and the receiver path callsloadTheme(...)which callsapplyTheme(...). Adding redraws toapplyThemetherefore fires on every tab automatically.Test Results
cargo fmt --all -- --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace --lib— 0 failednode --checkon themes.js / kanban.js / mindmap.js / connectors.js / objects.js — cleanImplementation Summary
Wire kanban / mindmap / connectors / sticky / shape / drawing defaults to the active theme. Existing widgets re-paint live when the theme changes; persisted user-chosen colors are preserved.
crates/hero_whiteboard_ui/static/web/js/whiteboard/themes.jsmindmap-*tokens todefaultTheme(Dark) and per-theme overrides for Light / Ocean / Warm / Minimal.applyTheme: instead of only re-drawing calendars, it now walks every registered object and callsWhiteboardKanban.redraw(group)/WhiteboardMindmap.redraw(group)/WhiteboardCalendar.redraw(group)for the matching type.WhiteboardConnectors.applyTheme()(added below) to recolor any default-stroke connectors.crates/hero_whiteboard_ui/static/web/js/whiteboard/kanban.jsReplaced hard-coded surface colors with
WhiteboardThemes.get('kanban-*'):#212529(board bg)kanban-bg#3b3b5c,#495057(borders)kanban-card-border#2b3035(column / card bg)kanban-column-bg/kanban-card-bg#dee2e6(titles / text)kanban-text-color#888/#555/#666(label / del / add idle)kanban-title-colorSelection accents (
#007AFF/#dc3545) are functional state colors and stayed as-is.COL_COLORS(per-column palette) also stayed since it conveys identity, not chrome.crates/hero_whiteboard_ui/static/web/js/whiteboard/mindmap.jsReplaced hard-coded node / link / placeholder / comment-popup colors with
mindmap-*reads. Per-node user colors stayed as-is (content). The flip indicator, +/− toggle, "+" add button, and the entire comment popup now use the theme palette. Title-edit and node-edit inline inputs read the theme background and text color.crates/hero_whiteboard_ui/static/web/js/whiteboard/connectors.jsconnector-strokeinstead of a hard-coded#007AFF._themeDefault: true.applyTheme()walks all connectors, recolors only those flagged_themeDefault. User-customized strokes are left alone, as are server-loaded connectors (which always carry an explicit stroke in their style payload).crates/hero_whiteboard_ui/static/web/js/whiteboard/objects.jsSTICKY_COLORSconstant replaced withgetStickyColors()that returnsWhiteboardThemes.get('sticky-colors')at call time, falling back to the legacy palette.group._mdFill) readstext-colorfrom the theme.createShapedefaults readshape-fill/shape-stroke/shape-stroke-width/shape-text-color.createDrawingdefaults readdraw-stroke/draw-stroke-width.Existing stickies / shapes / drawings keep their persisted colors — only future objects pick up the new defaults at create time. Existing kanbans / mindmaps re-paint on theme change.
Files Changed
themes.js— newmindmap-*tokens + redraw loop expansionkanban.js— surface tokensmindmap.js— node / link / popup tokensconnectors.js— theme default +applyThemehelperobjects.js— sticky palette + shape / text / drawing defaultsTest Results
cargo fmt --all -- --check— cleancargo clippy --workspace --all-targets -- -D warnings— cleancargo test --workspace --lib— 0 failednode --checkon all five modules — cleanManual smoke
#007AFF.Notes
WhiteboardThemes.get('calendar-*'); only the redraw loop was missing the kanban / mindmap branches.kanban-card-borderfor the menu hit hover,kanban-card-borderfor card hover) so hover transitions remain visible across themes.Iteration: fix
ReferenceErrorregressionRenaming
STICKY_COLORSto a getter insideobjects.jsleft a staleSTICKY_COLORS: STICKY_COLORSline in the public API export at line 1922. That undefined reference threw on module load, soWhiteboardObjectswas never set, which cascaded into "can't put anything or see the old board content" since every other module that touches objects would fail.Fix
objects.js— replaced the dead export withgetStickyColors: getStickyColors(the actual function added in step 5).properties.js— the one consumer at line 118 (WhiteboardObjects.STICKY_COLORS.forEach(...)) updated toWhiteboardObjects.getStickyColors().forEach(...).node --checkclean,cargo checkclean,cargo clippy --all-targets -D warningsclean,cargo test --workspace --lib0 failures.