Tokens (primitive design tokens)
+-- ColorTokens (primary, surface, error, text, border)
+-- SpacingTokens (none, xs, s, m, l, xl)
+-- TypographyTokens (label, body, heading sizes)
+-- RadiusTokens (small, medium, large, full)
+-- ElevationTokens (level0..level5 box shadows)
|
v
ComponentTheme (derived per-widget themes)
+-- ButtonTheme
+-- TextInputTheme
+-- ModalTheme
+-- TabsTheme
+-- TooltipTheme
+-- ... (13 component themes total)
|
v
Theme (top-level struct combining tokens + components)
Token | Light default | Dark default | Purpose |
|---|---|---|---|
primary | Purple 40 | Purple 80 | Primary interactive color |
on_primary | White | Black | Text/icon on primary surfaces |
secondary | Gray-purple | Teal | Secondary interactive color |
surface | Near-white | Dark gray (30) | Card and container backgrounds |
background | Near-white | Near-black (18) | Page background |
error | Red | Pink-red | Error states |
border | Light gray | Dark gray (60) | Borders and dividers |
text_primary | Near-black | Light gray | Primary text color |
text_secondary | Medium gray | Medium gray | Secondary/helper text |
Theme struct | Used by | Key fields |
|---|---|---|
ButtonTheme | Button | height, padding, radius, text size, elevation states, focus stroke |
TextInputTheme | TextInput | height, padding, radius, font size, border/focus/text/placeholder colors |
ModalTheme | Modal | background color, radius, shadow, max width |
TabsTheme | Tabs | active/inactive colors, indicator height, background, divider |
BadgeTheme | Badge | radius, font size |
AlertTheme | Alert | per-severity background colors, radius |
ProgressTheme | ProgressBar | height, track color, bar color |
TooltipTheme | Tooltip | background, text color, radius, font size |
CalendarTheme | Calendar | background, border, radius, selected/today colors |
PaginationTheme | Pagination | spacing, active background/text |
TimelineTheme | Timeline | dot size, line width, dot/line colors |
SegmentedControlTheme | SegmentedControl | background, border, radius, active colors |
TreeViewTheme | TreeView | indent, selected/hover backgrounds |
use fission_theme::{Theme, Tokens};
// Light theme (default)
let light = Theme::default();
// Dark theme
let dark = Theme::dark();
// Custom theme from modified tokens
let mut tokens = Tokens::default();
tokens.colors.primary = Color { r: 0, g: 120, b: 212, a: 255 }; // Blue
let custom = Theme {
tokens: tokens.clone(),
components: ComponentTheme::from_tokens(&tokens),
};
Tokens (primitive design tokens)
+-- ColorTokens (primary, surface, error, text, border)
+-- SpacingTokens (none, xs, s, m, l, xl)
+-- TypographyTokens (label, body, heading sizes)
+-- RadiusTokens (small, medium, large, full)
+-- ElevationTokens (level0..level5 box shadows)
|
v
ComponentTheme (derived per-widget themes)
+-- ButtonTheme
+-- TextInputTheme
+-- ModalTheme
+-- TabsTheme
+-- TooltipTheme
+-- ... (13 component themes total)
|
v
Theme (top-level struct combining tokens + components)
Token | Light default | Dark default | Purpose |
|---|---|---|---|
primary | Purple 40 | Purple 80 | Primary interactive color |
on_primary | White | Black | Text/icon on primary surfaces |
secondary | Gray-purple | Teal | Secondary interactive color |
surface | Near-white | Dark gray (30) | Card and container backgrounds |
background | Near-white | Near-black (18) | Page background |
error | Red | Pink-red | Error states |
border | Light gray | Dark gray (60) | Borders and dividers |
text_primary | Near-black | Light gray | Primary text color |
text_secondary | Medium gray | Medium gray | Secondary/helper text |
Theme struct | Used by | Key fields |
|---|---|---|
ButtonTheme | Button | height, padding, radius, text size, elevation states, focus stroke |
TextInputTheme | TextInput | height, padding, radius, font size, border/focus/text/placeholder colors |
ModalTheme | Modal | background color, radius, shadow, max width |
TabsTheme | Tabs | active/inactive colors, indicator height, background, divider |
BadgeTheme | Badge | radius, font size |
AlertTheme | Alert | per-severity background colors, radius |
ProgressTheme | ProgressBar | height, track color, bar color |
TooltipTheme | Tooltip | background, text color, radius, font size |
CalendarTheme | Calendar | background, border, radius, selected/today colors |
PaginationTheme | Pagination | spacing, active background/text |
TimelineTheme | Timeline | dot size, line width, dot/line colors |
SegmentedControlTheme | SegmentedControl | background, border, radius, active colors |
TreeViewTheme | TreeView | indent, selected/hover backgrounds |
use fission_theme::{Theme, Tokens};
// Light theme (default)
let light = Theme::default();
// Dark theme
let dark = Theme::dark();
// Custom theme from modified tokens
let mut tokens = Tokens::default();
tokens.colors.primary = Color { r: 0, g: 120, b: 212, a: 255 }; // Blue
let custom = Theme {
tokens: tokens.clone(),
components: ComponentTheme::from_tokens(&tokens),
};