Skip to content

Theme variables for the tree, combo box, context menu and form field editor colours - #364

Merged
rolandbanks merged 1 commit into
mainfrom
feature/theme-variables
Nov 12, 2026
Merged

rolandbanks merged 1 commit into
mainfrom
feature/theme-variables

Conversation

@rolandbanks

Copy link
Copy Markdown
Contributor

Summary

The tree, combo box, context menu and form field editor drew some colours in fixed values, so a host with a dark or coloured theme could only change them by overriding the library's scoped rules. Those colours now come from CSS variables a host can set on :root or on a theme class.

Every default is the colour the component drew before, so a host that sets nothing sees no change.

Component Variables Default
PDTree --pd-tree-selected-bg #007bff
--pd-tree-selected-color inherit
--pd-tree-node-radius (hover and selection share the shape) 0
--pd-tree-node-inset-end 0
PDComboBox --pdcb-focus-border #007bff
--pdcb-focus-ring rgba(0, 123, 255, 0.25)
PDContextMenu --pd-contextmenu-bg #fff
--pd-contextmenu-color inherit
--pd-contextmenu-hover-bg #eee
--pd-contextmenu-border-color rgba(0,0,0,.125)
--pd-contextmenu-disabled-color #6c757d
PDFormFieldEditor --pd-form-editor-border-color #ced4da

Under Bootstrap 5.3's data-bs-theme="dark", the context menu keeps its existing dark colours as defaults, and a host's variables still win.

Tests and documentation

  • ThemeVariableStylesheetTests checks each variable and its default, and that no colour in the context menu's stylesheet is fixed (12 tests, passing locally).
  • The PDTree, PDComboBox, PDContextMenu and PDForm documentation pages each gain a Colours section listing their variables.

Why

Magic Suite's themes currently restyle these components from their own stylesheet, with selectors deep enough to outweigh the library's scoped rules. With these variables they can set the colours directly, and other hosts can theme the same components without overrides.

🤖 Generated with Claude Code

…editor colours

The colours these components drew in fixed values now come from CSS variables a host can set on :root
or a theme class. Each default is the colour the component drew before, so a host that sets nothing
sees no change.

- PDTree: --pd-tree-selected-bg and --pd-tree-selected-color for the selected node, and
  --pd-tree-node-radius and --pd-tree-node-inset-end for the shape the hover and the selection share.
- PDComboBox: --pdcb-focus-border and --pdcb-focus-ring for the focused input.
- PDContextMenu: --pd-contextmenu-bg, -color, -hover-bg, -border-color and -disabled-color; under
  Bootstrap 5.3's dark mode the same variables win, with the existing dark colours as defaults.
- PDFormFieldEditor: --pd-form-editor-border-color for the frame around a field's editor.

ThemeVariableStylesheetTests checks each variable and its default, and that no context menu colour is
fixed. The four documentation pages gain a Colours section listing the variables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@rolandbanks
rolandbanks merged commit c1d198d into main Nov 12, 2026
2 of 4 checks passed
@rolandbanks
rolandbanks deleted the feature/theme-variables branch November 12, 2026 04:04
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 7 complexity · 0 duplication

Metric Results
Complexity 7
Duplication 0

View in Codacy

AI Reviewer: run a review on demand. To trigger the first review automatically, go to your organization or repository integration settings. AI can make mistakes. Always validate suggestions.

Run reviewer

TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant