Olddevs UI4.14.0

Theme studio

Theme, accent and brand repaint a small product made of kit components on the fly; you can set your own color too.

Open full screen

What it is built from

Try it

  • Switch the theme — “Light”, “Dark”, “Dim”: cards, the table and the fields repaint as a whole, while the accent stays put.
  • Change the accent (“Blue”, “Violet”) and the brand (“Teal”): buttons, tabs, the chart bars and the focus ring take the same color.
  • In the “Custom accent” section turn on “Use a custom color” and pick a color in the ColorPicker, and look at the code under the panel: it shows exactly what is written to <html>.
  • Open the “Settings” tab in the preview: the slider, the swatches and the switch use the same theme.

How it is built

The theme is attributes on <html>, not on a wrapper. The kit declares its tokens with selectors like :root[data-theme="light"], so they do not apply on a nested element. The Gallery screen changes data-theme, data-accent and data-brand on the frame's root through applyTheme and puts the previous values back when it leaves. The axes come from UI_THEMES, UI_ACCENTS and UI_BRANDS, so the list of options cannot drift from the kit's code.

The DOM is the source of truth, not state. The site page can also change the frame's theme, so two switches write to the same attribute. The controls therefore read the axes from <html> through a MutationObserver and never keep a copy of their own: change the theme on the site page and the segment in the panel updates without any code in the panel.

A brand takes precedence over the accent, and a custom color is the brand recipe with one color. The [data-brand] CSS rule cancels the accent axis entirely, so Teal repaints a violet accent too. The Gallery screen sets a custom color the way the “How to add a brand” section of Themes, tokens and brands tells you to set a brand: it overrides the --accent, --accent-hover, --accent-soft, --accent-strong, --focus-ring and --accent-on-inverse roles, only in the root's style instead of a stylesheet, and removes them on unmount. The kit does not check the contrast of a picked color: ColorPicker hands out a color outside the token system on purpose. So the Gallery screen darkens the button fill itself until white text on it reaches a 4.5:1 contrast ratio.

The label palette does not follow the accent. In Settings the SwatchGroup swatches are hues from the label palette, a closed set independent of data-accent and of the brand: switch the accent and the project colors stay as they were. This is how the kit separates “interface color” from “data color”. There is no density or radius control in the panel: the kit has no shared mechanism for them, and density lives only in tables (DataTable).