11# Customise Theme
22
3- Tiny UI provides two layers of theming :
3+ Tiny UI provides three ways to customise the look and feel :
44
5- 1 . ** Design tokens** — CSS custom properties that power light and dark mode. These are the runtime values every component reads.
6- 2 . ** SCSS variables** — compile-time variables (sizes, font stacks, border radii, etc.) that can be overridden when you build your own stylesheet.
5+ 1 . ** Theme Editor** — a visual, no-code tool for real-time theming (great for exploration and quick customisation).
6+ 2 . ** Design tokens** — CSS custom properties that power light and dark mode. These are the runtime values every component reads.
7+ 3 . ** SCSS variables** — compile-time variables (sizes, font stacks, border radii, etc.) that can be overridden when you build your own stylesheet.
8+
9+ ## Theme Editor
10+
11+ The built-in [ Theme Editor] ( /theme/theme-editor ) lets you visually customise design tokens in real time. You can:
12+
13+ - Pick from ** 20+ preset themes** (e.g. Catppuccin, Mocha Mousse, Cyberpunk) or start from scratch.
14+ - Adjust primary, success, warning, danger, and info colours, background, text, and border colours.
15+ - Tweak typography (font size, line height, font weight) and details (border radius, spacing, sizing).
16+ - Preview changes live on real components.
17+ - Export your customised tokens as CSS or SCSS to use in your project.
18+
19+ Changes are applied instantly via CSS custom properties — no rebuild required.
720
821## Dark mode
922
@@ -23,14 +36,23 @@ Tiny UI ships with built-in light and dark themes. Light mode is the default. To
2336You can also use the ` useTheme ` hook to switch themes at runtime:
2437
2538``` tsx
26- import { useTheme } from ' tiny-design' ;
39+ import { useTheme } from ' @ tiny-design/react ' ;
2740
2841const App = () => {
29- const { mode, setMode, toggle } = useTheme ();
30- return <button onClick = { toggle } >Current: { mode } </button >;
42+ const { mode, resolvedTheme, setMode, toggle } = useTheme ();
43+ return <button onClick = { toggle } >Current: { resolvedTheme } </button >;
3144};
3245```
3346
47+ The hook returns:
48+
49+ | Property | Type | Description |
50+ | ---| ---| ---|
51+ | ` mode ` | ` 'light' \| 'dark' \| 'system' ` | The stored preference |
52+ | ` resolvedTheme ` | ` 'light' \| 'dark' ` | The actual resolved theme (resolves ` 'system' ` to the OS preference) |
53+ | ` setMode(mode) ` | ` (mode: ThemeMode) => void ` | Set a specific mode |
54+ | ` toggle() ` | ` () => void ` | Toggle between light and dark |
55+
3456## Design tokens (CSS custom properties)
3557
3658Every colour, shadow, and visual state is exposed as a ` --ty-* ` CSS custom property on ` :root ` . You can override any token in your own stylesheet:
@@ -43,9 +65,21 @@ Every colour, shadow, and visual state is exposed as a `--ty-*` CSS custom prope
4365}
4466```
4567
68+ ### Commonly used tokens
69+
70+ | Token | Light default | Description |
71+ | ---| ---| ---|
72+ | ` --ty-color-primary ` | ` #6e41bf ` | Primary brand colour |
73+ | ` --ty-color-primary-hover ` | ` #8b62d0 ` | Primary hover state |
74+ | ` --ty-color-primary-active ` | ` #5a30a8 ` | Primary active state |
75+ | ` --ty-color-bg ` | ` #fff ` | Page background |
76+ | ` --ty-color-text ` | ` rgba(0,0,0,0.85) ` | Primary text colour |
77+ | ` --ty-color-text-secondary ` | ` rgba(0,0,0,0.65) ` | Secondary text colour |
78+ | ` --ty-color-border ` | ` #d9d9d9 ` | Default border colour |
79+
4680The full list of tokens can be found in the source:
47- - [ Light theme tokens] ( https://github.com/wangdicoder/tiny-design/blob/master/components/style /themes/_light.scss )
48- - [ Dark theme tokens] ( https://github.com/wangdicoder/tiny-design/blob/master/components/style /themes/_dark.scss )
81+ - [ Light theme tokens] ( https://github.com/wangdicoder/tiny-design/blob/master/packages/tokens/scss /themes/_light.scss )
82+ - [ Dark theme tokens] ( https://github.com/wangdicoder/tiny-design/blob/master/packages/tokens/scss /themes/_dark.scss )
4983
5084## SCSS variables
5185
@@ -70,7 +104,7 @@ $border-radius: 4px;
70104$font-size-base : 14px ;
71105
72106// Import Tiny UI styles (applies your overrides via !default)
73- @use " tiny-design/es/style/index" as * ;
107+ @use " @ tiny-design/react /es/style/index" as * ;
74108```
75109
76110### 3. Import in your entry file
@@ -79,7 +113,7 @@ $font-size-base: 14px;
79113import ' ./theme-variables.scss' ;
80114```
81115
82- The full list of SCSS variables can be found in [ _ variables.scss] ( https://github.com/wangdicoder/tiny-design/blob/master/components/style /_variables.scss ) .
116+ The full list of SCSS variables can be found in [ _ variables.scss] ( https://github.com/wangdicoder/tiny-design/blob/master/packages/tokens/scss /_variables.scss ) .
83117
84118Some commonly overridden variables:
85119
0 commit comments