Theme Studio
Theme Studio is an interactive tool: pick a preset, edit tokens one by one, preview live, and finally export a ready-to-use SCSS file.
Primary text·Regular text·Secondary text
Tokens you edit apply to the preview area only (same mechanism as ConfigProvider). The exported file also works in dark mode.
How to use
- Pick a preset: the top dropdown switches between the five built-in palettes (Ceramic Blue / Pine Green / Vermilion / Ink Wash / Golden Autumn). A preset only overrides the tokens it declares; the rest keep their current values.
- Edit tokens: every token has both a color picker and a hex text field, kept in sync. Optional tokens marked "follows default chain" (such as
--lh-selected-color) can be left empty to keep the stylesheet's default derivation. - Preview: the preview area renders real lh-ui components. Tokens are injected as local CSS variables (the same mechanism as
LhConfigProvider), scoped to the preview area only, without affecting the site. Toggle light / dark to check the dark adaptation. - Export: the SCSS text you copy or download already contains the
:roottoken block and the[data-theme='dark']dark block. The dark logic is fully isomorphic with share's preset mechanism (a deep-primary preset is automatically lightened in dark mode, otherwise the buttons would blend into the background).
Structure of the exported text
/* lh-ui custom theme — generated by Theme Studio (2026-01-01) */
@use '@lh-ui/share/styles/index.scss';
:root {
--lh-primary-color: #2B4C7C;
/* ... */
}
[data-theme='dark'],
.dark {
--lh-primary-color-bg: color-mix(in srgb, var(--lh-primary-color) 25%, transparent);
/* ... */
}
@usepulls in the full token baseline; the:rootblock only overrides the tokens you changed.- The dark block is derived by
buildPresetDarkVars, exactly matching what the preview area shows.
Notes
When applying preset variables you must write to a <style> element (specificity 0,1,0) — never to documentElement's inline style. Inline specificity is 1,0,0,0, higher than any stylesheet, and it would override the entire var-dark.scss dark variable block, distorting the dark-mode palette. Both the library's useLhPresetTheme and this site's anti-flicker script follow this rule.
A light-primary preset (such as Pine Green) needs explicit --lh-color-on-primary (ink text on the primary color) and --lh-selected-color (a deeper color for selected text); otherwise white text on a light primary falls short of AA contrast. The built-in presets handle this; check it yourself when customizing.
This tool is ported from lh-ui-plus's ThemeStudio. Token defaults, groups, and dark-derivation logic are all identical, and the exported SCSS works with both libraries (the tokens are defined in the shared layer @lh-ui/share/styles/theme/common/var.scss).