Skip to content

CSS design tokens

varsha’s design system is built entirely on CSS custom properties (CSS variables). Every color, font size, spacing value, radius, and shadow is a token that can be customized per theme or globally. This reference documents every token available.

varsha uses a three-layer token system:

  1. Primitive tokens — Raw palette colors defined per theme (e.g., --c-tokyo-night-bg: #1a1b26)
  2. Semantic tokens — Meaning-based mappings that point to primitive tokens (e.g., --bg, --fg, --accent)
  3. Component tokens — Component-specific values that reference semantic tokens (e.g., --nav-bg, --card-border)

When you switch themes (via the / key or data-palette attribute), the primitive tokens change, and all semantic and component tokens automatically update.

Reference tokens with var():

.my-component {
background: var(--surface);
color: var(--fg);
border: 1px solid var(--border);
padding: var(--sp-4);
border-radius: var(--radius-md);
}

Always prefer semantic tokens (--bg, --accent) over primitive tokens (--c-red) in your custom CSS. This ensures your components adapt correctly when themes change.

These are the primary tokens you will use in custom CSS and components:

TokenDescription
--bgPage background color
--fgPrimary foreground (body text)
--mutedMuted/secondary text color
--accentPrimary accent color (links, buttons, highlights)
--accent-fgText color on accent backgrounds
--borderDefault border color
--surfaceCard/panel/surface background color
--surface-hoverSurface color on hover
--selectionText selection background
TokenDescription
--code-bgCode block background
--code-fgCode block text color
--code-commentComment syntax color
--code-keywordKeyword syntax color
--code-stringString literal syntax color
--code-numberNumber literal syntax color
--code-functionFunction name syntax color
--code-variableVariable syntax color
TokenDescription
--successSuccess/positive state (green)
--warningWarning state (yellow/amber)
--dangerError/danger state (red)
--infoInformational state (blue)
TokenValueDescription
--font-sans'JetBrains Mono', monospaceDefault sans/UI font
--font-mono'JetBrains Mono', monospaceMonospace/code font
--font-serifserifSerif font (for quotes, editorial)

varsha uses JetBrains Mono as its primary typeface for a distinctive, technical aesthetic. The font is preloaded from /assets/jbm.woff2.

TokenValueTypical use
--fs-xs0.75remCaption, labels, badges
--fs-sm0.875remSmall text, metadata
--fs-base1remBody text (16px)
--fs-md1.125remLead text, large body
--fs-lg1.25remSmall headings
--fs-xl1.5remH4, card titles
--fs-2xl1.875remH3, section headings
--fs-3xl2.25remH2, page headings
--fs-4xl3remH1, hero titles
--fs-5xl3.75remDisplay text
--fs-6xl4.5remLarge display
TokenValueUse
--lh-tight1.2Headings
--lh-snug1.4Compact text
--lh-normal1.6Body text
--lh-relaxed1.75Long-form reading
TokenValueUse
--fw-regular400Body text
--fw-medium500UI labels, navigation
--fw-semibold600Subheadings, buttons
--fw-bold700Headings

Based on a 4px base unit:

TokenValueCommon use
--sp-0\.52pxHairline gaps
--sp-14pxIcon padding, tight gaps
--sp-28pxElement padding, small gaps
--sp-312pxCard padding, medium gaps
--sp-416pxSection padding, component gaps
--sp-524pxLarge gaps, item spacing
--sp-632pxSection spacing
--sp-848pxMajor sections
--sp-1064pxHero padding, page sections
--sp-1280pxLarge vertical rhythm
--sp-16128pxFull-page spacing
TokenDescription
--container-maxMax width of content containers (1200px)
--container-paddingHorizontal padding on containers (var(--sp-4))
--nav-heightHeight of the navigation header
TokenValueUse
--radius-sm4pxBadges, small elements
--radius-md8pxButtons, inputs, cards
--radius-lg12pxLarge cards, modals
--radius-xl16pxHero cards, panels
--radius-full9999pxPills, avatar circles
TokenDescription
--shadow-smSubtle shadow for interactive elements (hover states)
--shadow-mdMedium shadow for cards and elevated surfaces
--shadow-lgLarge shadow for dropdowns, modals, popovers
--shadow-glowAccent-colored glow for focus states and featured elements

Shadow tokens automatically adapt to the active theme — dark themes use more subtle shadows to avoid visual mud.

TokenValueUse
--transition-fast150ms easeHover states, color changes
--transition-base250ms easeStandard transitions
--transition-slow400ms easeTheme switching, large animations
TokenValuePurpose
--z-base0Default stacking
--z-nav100Navigation header
--z-overlay500Modal overlays
--z-modal600Modal dialogs
--z-toast700Toast notifications
--z-builtwith999Attribution badge

While not CSS custom properties, varsha uses consistent responsive breakpoints in its CSS:

NameWidthTarget
sm640pxLarge phones
md768pxTablets
lg1024pxSmall laptops
xl1280pxDesktops

In media queries:

@media (max-width: 768px) {
/* Mobile/tablet styles */
}

varsha ships with 18+ themes, each defined as a set of primitive color tokens scoped to a [data-palette="theme-name"] selector:

ThemeTypePalette ID
Tokyo NightDarktokyo-night
Tokyo DayLighttokyo-night-day
CatppuccinDarkcatppuccin
Catppuccin LatteLightcatppuccin-latte
TerminalDarkterminal
DraculaDarkdracula
NordDarknord
GruvboxDarkgruvbox
Gruvbox LightLightgruvbox-light
One DarkDarkone-dark
One LightLightone-light
SolarizedDarksolarized
Solarized LightLightsolarized-light
KanagawaDarkkanagawa
Kanagawa LotusLightkanagawa-lotus
Rose PineDarkrose-pine
Rose Pine DawnLightrose-pine-dawn
VesperDarkvesper

See the Themes guide for details on switching themes and creating custom palettes.

To override a token globally, set it on :root in your custom CSS:

:root {
--accent: #6366f1;
--radius-md: 6px;
--fs-base: 1.0625rem;
}

To create a custom theme, define a new [data-palette="my-theme"] block in public/css/style.css with all required color tokens.

Themes

Switch between built-in themes and create custom palettes.

Themes →

Customization

Brand your site with colors, typography, and metadata.

Customization →

Design system

Understand the principles behind varsha’s token architecture.

Design system →