zidane-ui/ theme
import { … } from 'zidane-ui/theme'ui/src/theme/index.ts
Functions#
legacyThemePatchFunction#
The change a first run's appearance takes from legacyThemeId, or null for none: an unknown id (a fallback is
never pinned) or the default theme leave the defaults alone.
function legacyThemePatch(
legacyThemeId: string | undefined,
extraThemes?: readonly Theme[],
): LegacyThemePatch | nullParameters
| Name | Type | Default | Description |
|---|---|---|---|
| legacyThemeId | string | undefined | The theme id the settings name. | |
| extraThemes? | readonly Theme[] | [] | Themes beyond the built-in ones (extensions'). |
Returns
LegacyThemePatch | nullpaletteOfFunction#
Derives the palette of theme, its accent (and focus ring) replaced by accentOverride when set.
function paletteOf(theme: Theme, accentOverride?: string | null): ResolvedPaletteParameters
| Name | Type | Default | Description |
|---|---|---|---|
| theme | Theme | The active theme. | |
| accentOverride? | string | null | null | The user's accent ( |
Returns
Constants#
DISABLED_OPACITYConstant#
One disabled look for every control.
const DISABLED_OPACITY = 0.5EASINGConstant#
The easing curves (cubic-bezier control points) the tweens use.
const EASING: { readonly drawer: readonly [0.32, 0.72, 0, 1]; readonly fade: readonly [0.33, 1, 0.68, 1]; readonly in: readonly [0.4, 0, 1, 1]; readonly inOut: readonly [0.77, 0, 0.175, 1]; readonly out: readonly [0.23, 1, 0.32, 1] }FONT_SIZEConstant#
The interface type scale (outside the transcript and composer bodies):
badge count badges, meta the technical voice, label secondary text,
ui controls and rows, body reading text, title a page-sized view's heading.
const FONT_SIZE: { readonly badge: 10; readonly body: 14; readonly figure: 28; readonly label: 12; readonly meta: 11; readonly title: 20; readonly ui: 13 }PHONE_CODE_SIZEConstant#
The phone's code size: monospace reads larger than its point size, so a step under subhead.
const PHONE_CODE_SIZE = 14PHONE_TYPEConstant#
The phone's type scale. Phones read at arm's length: the steps follow the platforms' own
defaults (iOS Human Interface Guidelines), not the desktop's denser interface scale.
largeTitle a screen's title, title a sheet's, headline a row's title or a message's
author, body reading text (the transcript too), subhead secondary text in a row,
footnote metadata, caption the smallest text that is still read.
const PHONE_TYPE: { readonly body: { readonly ios: 'body'; readonly lineHeight: 22; readonly size: 17; readonly weight: '400' }; readonly caption: { readonly ios: 'caption1'; readonly lineHeight: 16; readonly size: 12; readonly weight: '400' }; readonly footnote: { readonly ios: 'footnote'; readonly lineHeight: 18; readonly size: 13; readonly weight: '400' }; readonly headline: { readonly ios: 'headline'; readonly lineHeight: 22; readonly size: 17; readonly weight: '600' }; readonly largeTitle: { readonly ios: 'largeTitle'; readonly lineHeight: 41; readonly size: 34; readonly weight: '700' }; readonly subhead: { readonly ios: 'subheadline'; readonly lineHeight: 20; readonly size: 15; readonly weight: '400' }; readonly title: { readonly ios: 'title2'; readonly lineHeight: 28; readonly size: 22; readonly weight: '700' } }RADIUSConstant#
Corner radius steps. Surfaces pick from them, never ad hoc.
const RADIUS: { readonly '2xl': 24; readonly lg: 12; readonly md: 8; readonly sm: 6; readonly xl: 16; readonly xs: 4 }READING_SIZEConstant#
The reading sizes: the transcript body (chat), the composer (prompt) and code.
const READING_SIZE: { readonly chat: 15; readonly code: 12; readonly prompt: 15 }SPACEConstant#
Spacing steps for native layouts (the web uses Uno's spacing): a 4-point
grid, from the hairline gap between stacked lines of text (xxs) to the space between sections (xxl).
const SPACE: { readonly lg: 16; readonly md: 12; readonly sm: 8; readonly xl: 24; readonly xs: 4; readonly xxl: 32; readonly xxs: 2 }Interfaces#
PhoneTypeStepInterface#
A step of the phone's type scale: its default size and line height, its weight, and the platform text style it follows when the user changes the text size (iOS Dynamic Type, Android font scale).
interface PhoneTypeStepProperties
| Name | Type | Description |
|---|---|---|
| ios | 'headline' | 'body' | 'largeTitle' | 'title2' | 'subheadline' | 'footnote' | 'caption1' | The iOS text style it scales with. |
| lineHeight | number | Line height at the default text size. |
| size | number | Size at the default text size. |
| weight | '700' | '400' | '500' | '600' | Weight, as CSS writes it. |
Types#
FontSizeStepType#
LegacyThemePatchType#
What a first run's appearance takes from a theme id: the slot the theme fills, and the mode that shows it.
type LegacyThemePatch =
| { lightTheme: string; mode: 'light' }
| { darkTheme: string; mode: 'dark' }PhoneTypeNameType#
A PHONE_TYPE step.
type PhoneTypeName = keyof typeof PHONE_TYPERadiusStepType#
SpaceStepType#
Re-exports#
These names are documented on the entry point that owns them.