Theming

Guide

All visual decisions live in CSS custom properties. Override any token to restyle the entire system without touching component code.

Dark & Light mode

Forma is dark-first. The default :root defines a dark palette. To switch to light mode, add data-theme="light" on <html>:

<html data-theme="light">

To persist the user's preference across sessions, store it in localStorage under the key forma-theme and read it synchronously before paint:

index.html — inline script in <head>
;(function () {
  const t = localStorage.getItem('forma-theme')
  if (t) document.documentElement.setAttribute('data-theme', t)
})()

Custom theme

Add a new data-theme value to create a third palette (e.g. brand, high-contrast):

[data-theme="brand"] {
  --color-bg-base:       #0f0a1e;
  --color-bg-surface-1:  #1a1030;
  --color-text-primary:  #c4b5fd;
  --color-brand:         #8b5cf6;
  --color-brand-bg:      #8b5cf6;
  --color-brand-fg:      #ffffff;
}

Token reference

Backgrounds
CSS variableTailwind classDark defaultRole
--color-bg-basebg-bg-base#090909Page canvas
--color-bg-surface-1bg-bg-surface-1#111111Cards, sidebars, nav
--color-bg-surface-2bg-bg-surface-2#181818Inputs, dropdowns, code blocks
--color-bg-surface-3bg-bg-surface-3#202020Hover fills, selected rows
--color-bg-overlaybg-bg-overlayrgba(0,0,0,.72)Dialog/drawer backdrop
Text
CSS variableTailwind classDark defaultRole
--color-text-primarytext-text-primary#f0f0f0Headings, body
--color-text-secondarytext-text-secondaryrgba(240,240,240,.52)Supporting copy
--color-text-mutedtext-text-mutedrgba(240,240,240,.22)Labels, counters
--color-text-disabledtext-text-disabledrgba(240,240,240,.28)Disabled states
--color-text-invertedtext-text-inverted#090909Text on primary bg
Borders
CSS variableTailwind classDark defaultRole
--color-border-subtleborder-border-subtlergba(255,255,255,.07)Dividers, card edges
--color-border-defaultborder-border-defaultrgba(255,255,255,.13)Input borders
--color-border-strongborder-border-strongrgba(255,255,255,.22)Focus, active rings
Border Radius
CSS variableTailwind classValueUsage
--radius-smrounded-sm2pxButtons, inputs (site-wide default)
--radius-mdrounded-md4pxCards, dropdowns, popovers
--radius-lgrounded-lg8pxDialogs, drawers
--radius-xlrounded-xl12pxLarge panels
--radius-fullrounded-full9999pxPills, badges, switch tracks
Typography
CSS variableTailwind classValueRole
--font-displayfont-displaySyne, system-uiHeadings, logotype
--font-bodyfont-bodyDM Sans, system-uiUI text, body copy
--font-monofont-monoDM Mono, Fira CodeCode blocks
Semantic
CSS variableDefaultSiblings
--color-error#ff6b6b--color-error-bg, --color-error-border
--color-success#4dff91--color-success-bg, --color-success-border
--color-warning#ffb74d--color-warning-bg, --color-warning-border
--color-info#60a5fa--color-info-bg, --color-info-border