Skip to content

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.

TypeScript
function legacyThemePatch(
  legacyThemeId: string | undefined,
  extraThemes?: readonly Theme[],
): LegacyThemePatch | null
Parameters
NameTypeDefaultDescription
legacyThemeIdstring | undefined

The theme id the settings name.

extraThemes?readonly Theme[][]

Themes beyond the built-in ones (extensions').

ui/src/theme/legacy-theme.ts:20

paletteOfFunction#

Derives the palette of theme, its accent (and focus ring) replaced by accentOverride when set.

TypeScript
function paletteOf(theme: Theme, accentOverride?: string | null): ResolvedPalette
Parameters
NameTypeDefaultDescription
themeTheme

The active theme.

accentOverride?string | nullnull

The user's accent (#rrggbb), or null for the theme's own.

ui/src/theme/palette-of.ts:17

Constants#

DISABLED_OPACITYConstant#

One disabled look for every control.

TypeScript
const DISABLED_OPACITY = 0.5

ui/src/theme/scales.ts:31

EASINGConstant#

The easing curves (cubic-bezier control points) the tweens use.

TypeScript
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] }

ui/src/theme/scales.ts:43

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.

TypeScript
const FONT_SIZE: { readonly badge: 10; readonly body: 14; readonly figure: 28; readonly label: 12; readonly meta: 11; readonly title: 20; readonly ui: 13 }

ui/src/theme/scales.ts:22

PHONE_CODE_SIZEConstant#

The phone's code size: monospace reads larger than its point size, so a step under subhead.

TypeScript
const PHONE_CODE_SIZE = 14

ui/src/theme/scales.ts:93

PHONE_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.

TypeScript
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' } }

ui/src/theme/scales.ts:79

RADIUSConstant#

Corner radius steps. Surfaces pick from them, never ad hoc.

TypeScript
const RADIUS: { readonly '2xl': 24; readonly lg: 12; readonly md: 8; readonly sm: 6; readonly xl: 16; readonly xs: 4 }

ui/src/theme/scales.ts:12

READING_SIZEConstant#

The reading sizes: the transcript body (chat), the composer (prompt) and code.

TypeScript
const READING_SIZE: { readonly chat: 15; readonly code: 12; readonly prompt: 15 }

ui/src/theme/scales.ts:28

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).

TypeScript
const SPACE: { readonly lg: 16; readonly md: 12; readonly sm: 8; readonly xl: 24; readonly xs: 4; readonly xxl: 32; readonly xxs: 2 }

ui/src/theme/scales.ts:37

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).

TypeScript
interface PhoneTypeStep
PhoneTypeStep properties
NameTypeDescription
ios'headline' | 'body' | 'largeTitle' | 'title2' | 'subheadline' | 'footnote' | 'caption1'

The iOS text style it scales with.

lineHeightnumber

Line height at the default text size.

sizenumber

Size at the default text size.

weight'700' | '400' | '500' | '600'

Weight, as CSS writes it.

ui/src/theme/scales.ts:61

Types#

FontSizeStepType#

A FONT_SIZE step.

TypeScript
type FontSizeStep = keyof typeof FONT_SIZE

ui/src/theme/scales.ts:25

LegacyThemePatchType#

What a first run's appearance takes from a theme id: the slot the theme fills, and the mode that shows it.

TypeScript
type LegacyThemePatch =
  | { lightTheme: string; mode: 'light' }
  | { darkTheme: string; mode: 'dark' }

ui/src/theme/legacy-theme.ts:11

PhoneTypeNameType#

A PHONE_TYPE step.

TypeScript
type PhoneTypeName = keyof typeof PHONE_TYPE

ui/src/theme/scales.ts:90

RadiusStepType#

A RADIUS step.

TypeScript
type RadiusStep = keyof typeof RADIUS

ui/src/theme/scales.ts:15

SpaceStepType#

A SPACE step.

TypeScript
type SpaceStep = keyof typeof SPACE

ui/src/theme/scales.ts:40

Re-exports#

These names are documented on the entry point that owns them.