Theming

stable

Token reference for Farn's two-axis theming system. For the design rationale and live demos, see Foundations › Surfaces.

Surface Depth

Apply data-surface to set depth on any element. Tokens resolve automatically for the active theme.

data-surface Light --color-bg Dark --color-bg Light --color-bg-panel Dark --color-bg-panel Use
base --bm2-birch --in0-void inherits inherits Resets to page bg inside a deeper surface
layer --bm1-mist --in1-iron --bm2-birch --in2-slate Cards, sidebars, panels
overlay --bm0-sand --in2-slate inherits --in2-slate (capped) Modals, dropdowns, floating elements

The dark overlay ceiling: in dark mode --color-bg-panel inside an overlay is capped at --in2-slate — the same as the overlay background — because slate is the deepest available surface.

Theme Toggle

Set data-theme on any element to control its theme context. All semantic tokens re-declare inside [data-theme] — no extra overrides needed.

<!-- Page-level: set on <html> -->
<html data-theme="dark">

<!-- Element-level: local override -->
<section data-theme="dark">
  Always dark, regardless of the page theme
</section>

<!-- Composed: pinned theme + explicit depth -->
<section data-theme="dark" data-surface="layer">
  Dark panel, card depth
</section>

Semantic Token Reference

All component styles reference these tokens — never raw palette tokens.

Background

TokenLightDarkUse
--color-bg--bm2-birch--in0-voidPage background
--color-bg-panel--bm1-mist--in1-ironCards, panels
--color-bg-inset--bm0-sand--in2-slateInput fills, sunken areas
--color-bg-code--fo3-deepwater--in1-ironCode block background

Text

TokenLightDarkUse
--color-text--in0-void--bm2-birchPrimary text
--color-text-secondary--in2-slate--bm1-mistSupporting text
--color-text-tertiary--in3-ash--bm0-sandPlaceholders, captions (AA Large only)

Borders

TokenLightDarkUse
--color-border--in3-ash--in2-slateDefault border
--color-border-strong--in1-iron--bm0-sandProminent dividers
--color-border-subtlergba 55,65,81 12%rgba 75,85,99 25%Hairline borders

Accent & State

TokenBoth modesUse
--color-accent--fo1-fernCTAs, links, focus ring
--color-accent-hoverlight: forest · dark: sageHover state
--color-accent-text--bm2-birchText on accent backgrounds
--color-error--bl0-emberError, destructive
--color-warning--bl2-grainWarning, draft
--color-success--bl3-mossSuccess, published

FOWT Prevention

Always add the inline FOWT script to <head> before anything else renders. See Foundations › Surfaces for the full explanation, or Getting Started for setup steps.