theme/themes
import { … } from 'zidane-ui'ui/src/theme/themes.ts
Functions#
resolveThemeFunction#
Finds a theme by id.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
| id | string | undefined | The theme id. May be | |
| extraThemes? | readonly Theme[] | [] | Extension themes, checked before the built-in ones. |
Returns
ThemeThe matching theme, or DEFAULT_THEME when the id is missing or unknown.
Constants#
BUILTIN_THEMESConstant#
The built-in themes by id. Insertion order is the picker cycle order: default first, then
light, then the dark and light families.
const BUILTIN_THEMES: Readonly<Record<string, Theme>>DEFAULT_THEMEConstant#
The default dark theme, used when an id is unknown.
const DEFAULT_THEME: ThemeInterfaces#
SyntaxTokenStyleInterface#
Style of one syntax token: colours and font emphasis.
interface SyntaxTokenStyleProperties
| Name | Type | Description |
|---|---|---|
| bg? | string | Background colour. |
| bold? | boolean | Draw the token in bold. |
| fg? | string | Text colour. |
| italic? | boolean | Draw the token in italic. |
| underline? | boolean | Draw the token underlined. |
ThemeInterface#
A colour theme: its identity, palette, selection colours, surfaces and syntax styles. It parallels the terminal UI's themes but keeps only what the GUI reads.
interface ThemeProperties
| Name | Type | Description |
|---|---|---|
| colors | ThemeColors | The theme's palette. |
| id | string | Unique id, such as |
| label | string | Name shown in the theme picker. |
| select | ThemeSelect | Colours of selectable option lists. |
| surfaces | ThemeSurfaces | Surface, selection, chip and diff colours. |
| syntax | SyntaxStyles | Syntax token styles. |
ThemeColorsInterface#
GUI theme registry. Spiritually parallel to the canonical TUI themes
in zidane/src/chat/themes/* but decoupled — the renderer only
consumes a narrow subset (palette, surfaces and syntax.default.fg),
so we keep the shape local and avoid lockstepping with canonical
theme-type churn (which carries TUI-only fields the GUI never reads).
GUI-only color slots that aren't in the TUI palette:
throbber: [from, to]— Throbber gradient endpoints; defaults tobrandand a mutedaccentwhen omitted.money: string— footer cost-pill tint; defaults to--zg-text-mutedwhen omitted.
interface ThemeColorsProperties
| Name | Type | Description |
|---|---|---|
| accent | string | Secondary hue, usually a success green. It becomes the palette's |
| border | string | Default border colour. |
| borderActive | string | Border colour of the focused or active element. It becomes the palette's focus |
| brand | string | Brand and interactive colour. It becomes the palette's |
| dim | string | Secondary text colour. It becomes the palette's |
| error | string | Error status colour. It becomes the palette's |
| model | string | Tint that identifies the model. |
| money? | string | Tint of the footer cost figure. Defaults to the muted text colour. |
| mute | string | Tertiary text colour. It becomes the palette's |
| throbber? | readonly [string, string] | The two colours of the busy indicator. Defaults to |
| warn | string | Warning status colour. |
ThemeDiffInterface#
Colours of a diff in a theme.
interface ThemeDiffProperties
| Name | Type | Description |
|---|---|---|
| addBg | string | Background of an added line. |
| addContentBg? | string | Stronger background behind the changed text inside an added line. Derived when omitted. |
| addFg | string | Text colour of an added line. |
| removeBg | string | Background of a removed line. |
| removeContentBg? | string | Stronger background behind the changed text inside a removed line. Derived when omitted. |
| removeFg | string | Text colour of a removed line. |
ThemeSelectInterface#
Colours of a list of selectable options, in the shape the terminal themes use.
interface ThemeSelectProperties
| Name | Type | Description |
|---|---|---|
| backgroundColor | string | Background of an option. |
| descriptionColor | string | Colour of an option's description. |
| focusedBackgroundColor | string | Background of the focused option. |
| selectedBackgroundColor | string | Background of the selected option. |
| selectedDescriptionColor | string | Colour of the selected option's description. |
| selectedTextColor | string | Text colour of the selected option. |
| textColor | string | Text colour of an option. |
ThemeSurfacesInterface#
Surface colours of a theme: the window canvas, reference chips, selection and diffs.
interface ThemeSurfacesProperties
| Name | Type | Description |
|---|---|---|
| chips | { default: { bg: string; fg: string }; files: { bg: string; fg: string }; skills: { bg: string; fg: string } } | Background and text colour of each kind of reference chip. |
| diff | ThemeDiff | Diff colours. |
| modal | string | Background of the window and modal layers. It becomes the palette's canvas. |
| selection | string | Text selection background. |
Types#
SyntaxStylesType#
Styles of syntax tokens by token name. The default entry's fg is the palette's body text
colour.
type SyntaxStyles = Partial<Record<string, SyntaxTokenStyle>>