Skip to content
Sveltier
Mode
Theming

Theme contract

Every theme sets the same typed list of variables, so components can take every stylistic decision from the theme and never hard-code a look.

Why a contract

THEME_VARIABLES lists the keys every theme must define, and the ThemeDefinition type enforces it: a theme with a missing key does not compile. That keeps all five built-in themes interchangeable and tells you exactly what a custom theme can control.

Variables

Values are live for monolith-light.

VariableControlsValue
--sv-font-displayFamily for headings and large figures.'Geist Variable', system-ui, sans-serif
--sv-font-uiFamily for interface text: labels, buttons, body copy.'Geist Variable', system-ui, sans-serif
--sv-font-dataFamily for tabular data and code.'Geist Mono Variable', ui-monospace, monospace
--sv-weight-displayWeight of display text.600
--sv-tracking-displayLetter spacing of display text.-0.035em
--sv-label-sizeSize of small labels and table headers.0.7862rem
--sv-label-transformCasing of small labels (none or uppercase).none
--sv-label-trackingLetter spacing of small labels.0
--sv-button-transformCasing of button text.none
--sv-button-trackingLetter spacing of button text.0
--sv-radius-smSmall radius: chips, checkboxes.5px
--sv-radius-mdControl radius: buttons, inputs, segmented controls.8px
--sv-radius-lgLarger radius: menus, toasts.13px
--sv-radius-xlSurface radius: cards, dialogs.21px
--sv-radius-fullRadius of round things: avatars, switches, progress bars.999px
--sv-surface-alphaOpacity of surfaces; below 100% gives frosted panels.100%
--sv-surface-blurBackdrop blur behind translucent surfaces.0px
--sv-backdropDecorative image behind the page or a scope (gradients), or none.none
--sv-ornamentColour of decorative hairlines on surfaces, or transparent.transparent
--sv-bevelColour of the 1px highlight on the top edge of raised surfaces.oklch(1 0 0 / 0)
--sv-shadowElevation shadow of raised surfaces.0 1px 2px oklch(0.2 0.01 260 / 0.06), 0 13px 34px -21px oklch(0.2 0.01 260 / 0.24)
--sv-easeEasing curve for every transition.cubic-bezier(0.236, 0, 0, 1)
--sv-duration-fastDuration of small state changes (hover, press).144ms
--sv-duration-normalDuration of most transitions.233ms
--sv-duration-slowDuration of larger movements (thumbs, panels).377ms

Using the variables

Your own components can follow the active theme the same way Sveltier's do:

my-card.css
.my-card {
  border-radius: var(--sv-radius-xl);
  font-family: var(--sv-font-ui);
  box-shadow: inset 0 1px 0 var(--sv-bevel), var(--sv-shadow);
  transition: transform var(--sv-duration-normal) var(--sv-ease);
}

.my-card h2 {
  font: var(--sv-weight-display) var(--sv-text-title) / var(--sv-leading-snug)
    var(--sv-font-display);
  letter-spacing: var(--sv-tracking-display);
}

Motion and reduced motion

Themes set their own easing and durations. When the user asks for reduced motion, the base stylesheet collapses all three durations to near zero from a later cascade layer, so it wins over every theme without you doing anything.