Theme Variables

Every CSS variable a theme file can set, with its default and its range

A theme file sets these CSS variables on :root inside @layer sa.theme. Leave out any variable you don't change. The theme builder has a control for each variable below, with the same ranges.

The package ships the same list as stellar-admin.theme-variables.json (at /_content/StellarAdmin.TagHelpers/stellar-admin.theme-variables.json), which tools can read for the variables of the installed version.

Essential variables

Most themes are made from these alone.

VariableDefaultValuesMeaning
--sa-accentoklch(0.5 0.16 258)any colourBrand colour: primary actions, focus, selection, bold highlights.
--sa-neutral-hue2550 to 360Hue the greys lean toward.
--sa-neutral-chroma0.0060 to 0.04How much the greys lean (0 is pure grey).
--sa-radius6px0px to 24px, Pill (9999px)Control corners.
--sa-pills00 or 1Tags (badges, chips, the switch) are pills instead of following the radius.
--sa-relief00 (Flat), 1 (Raised), 2 (Tactile)Raised adds a shadow under buttons; tactile also adds a bottom edge, a hover lift, a pressed state and recessed fields.
--sa-elevation0.70 to 3Shadow strength: 0 flat, 1 soft, 2 or more floating.
--sa-density10.7 to 1.4Spacing and control sizes, not type: 0.75 dense to 1.25 roomy.
--sa-font-sans"Inter", ui-sans-serif, system-ui, sans-serifa font stack; the theme builder offers Inter, Geist, IBM Plex Sans, Figtree, Source Sans 3, Space Grotesk, Lexend, Archivo, SystemBody and control font.
--sa-font-headingvar(--sa-font-sans)a font stack; the theme builder offers Same as body, Fraunces, Space Grotesk, LexendTitles.

Colour

Colours accept any CSS colour syntax. The accent's fills and text forms are adjusted for contrast automatically, so any lightness works. Variables that follow another variable are unset by default: set them only when dark mode or text on the accent should differ.

VariableDefaultValuesMeaning
--sa-accentoklch(0.5 0.16 258)any colourBrand colour: primary actions, focus, selection, bold highlights.
--sa-accent-darkUnset: follows Accentany colourThe accent in dark mode.
--sa-on-accentUnset: follows Accentany colourText on accent fills, instead of the automatic black or white.
--sa-dangeroklch(0.58 0.22 27)any colourDestructive actions and errors.
--sa-danger-darkUnset: follows Dangerany colourThe danger colour in dark mode.
--sa-successoklch(0.6 0.15 150)any colourStatus colour for success.
--sa-warningoklch(0.72 0.16 70)any colourStatus colour for warnings.
--sa-infooklch(0.6 0.14 240)any colourStatus colour for information.
--sa-neutral-hue2550 to 360Hue the greys lean toward.
--sa-neutral-chroma0.0060 to 0.04How much the greys lean (0 is pure grey).
--sa-neutral-hue-darkUnset: follows Neutral hue0 to 360The neutral hue in dark mode.
--sa-neutral-chroma-darkUnset: follows Neutral tint0 to 0.04The neutral tint in dark mode.
--sa-accent-tint0.150 to 1How much the accent tints hover, selection and highlight washes.
--sa-surface-depth0.80 to 1Separation between the page and cards (0 is one flat surface).
--sa-nav-tint0.50 to 1The sidebar, from page colour to sunken.
--sa-line-strength10.75 to 2Dividers and control borders (below 0.75 acts as 0.75).

Shape and depth

VariableDefaultValuesMeaning
--sa-radius6px0px to 24px, Pill (9999px)Control corners.
--sa-radius-outerUnset: follows Radius0px to 32pxCard and dialog corners.
--sa-pills00 or 1Tags (badges, chips, the switch) are pills instead of following the radius.
--sa-outlines10 or 1Filled parts (buttons, badges, chips, the switch track) also draw an outline.
--sa-relief00 (Flat), 1 (Raised), 2 (Tactile)Raised adds a shadow under buttons; tactile also adds a bottom edge, a hover lift, a pressed state and recessed fields.
--sa-sheen10 or 1Solid buttons get a lit surface: a gradient, a top highlight, a darker edge and a pressed shadow.
--sa-stroke1px0px to 3pxBorder width.
--sa-elevation0.70 to 3Shadow strength: 0 flat, 1 soft, 2 or more floating.

Space and type

Density scales spacing and control sizes, not text; the type scale changes text sizes. Each font variable is a font stack: end it with native fallbacks, and load the web font from your layout (see fonts).

VariableDefaultValuesMeaning
--sa-density10.7 to 1.4Spacing and control sizes, not type: 0.75 dense to 1.25 roomy.
--sa-type-scale10.8 to 1.2Text sizes.
--sa-font-sans"Inter", ui-sans-serif, system-ui, sans-serifa font stack; the theme builder offers Inter, Geist, IBM Plex Sans, Figtree, Source Sans 3, Space Grotesk, Lexend, Archivo, SystemBody and control font.
--sa-font-headingvar(--sa-font-sans)a font stack; the theme builder offers Same as body, Fraunces, Space Grotesk, LexendTitles.
--sa-font-monoui-monospace, "SFMono-Regular", Menlo, Consolas, monospacea font stack; the theme builder offers System, JetBrains Mono, IBM Plex Mono, Geist MonoCode.
--sa-kbd-fontUnset: follows Fontvar(--sa-font-mono) (Monospace)Keyboard keys.
--sa-weight-control500400 (400), 500 (500), 600 (600)Buttons, tabs, menu items.
--sa-weight-heading600400 (400), 500 (500), 600 (600), 700 (700)Titles.
--sa-leading-body1.51.3 to 1.8Line height of running text.

Section labels

Menu labels, sidebar group labels, and table column heads when they take the section label style.

VariableDefaultValuesMeaning
--sa-section-label-fontinheritinherit (Body font), var(--sa-font-heading) (Heading font), var(--sa-font-mono) (Monospace)Section labels: menu labels, sidebar group labels, and column heads when they take the section label style.
--sa-section-label-textcalc(0.71875rem * var(--sa-type-scale))var(--sa-text-2xs) (11px), calc(0.71875rem * var(--sa-type-scale)) (11.5px), var(--sa-text-xs) (12px), var(--sa-text-sm) (14px)Section label text size.
--sa-section-label-weight500400 (400), 500 (500), 600 (600), 700 (700)Section label weight.
--sa-section-label-transformnonenone (As written), uppercase (Uppercase)Section label case.
--sa-section-label-tracking0em0em to 0.15emSection label letter spacing.

Structure

VariableDefaultValuesMeaning
--sa-footer-fill00 or 1Card footers sit on a tinted band.
--sa-footer-rule10 or 1Card footers have a divider above them.
--sa-dialog-footer-fillUnset: follows Card footer band0 or 1Dialog and sheet footers sit on a tinted band.
--sa-dialog-footer-ruleUnset: follows Card footer rule0 or 1Dialog and sheet footers have a divider above them.
--sa-column-head-label00 or 1Table column heads take the section label style.
--sa-column-head-fill10 or 1Table column heads sit on a sunken band.
--sa-column-head-casenonenone (As written), uppercase (Uppercase), var(--sa-section-label-transform) (As section labels)Table column head case.
--sa-column-head-fontinheritinherit (Body font), var(--sa-font-mono) (Monospace)Table column head font.
--sa-current-page-fill00 (Outline), 0.15 (Soft), 1 (Solid)The current page in pagination.

Buttons

VariableDefaultValuesMeaning
--sa-solid-destructive10 or 1Destructive buttons are solid instead of a soft tint.
--sa-filled-secondary10 or 1Secondary buttons have a sunken fill instead of a bordered surface.
--sa-link-decorationnonenone (No underline), underline (Underline)Link buttons at rest.
--sa-press-offset1px0px to 2pxHow far a button moves when pressed.

Focus

VariableDefaultValuesMeaning
--sa-focus-width3px1px to 4pxFocus ring width.
--sa-focus-offset0px0px to 4pxGap between the control and the ring.
--sa-focus-colorUnset: follows Accentany colourFocus ring colour.

On this page