Colors & Theming

The package ships a single token file — h2o-library/dist/styles/index.css — that defines every --* color used by components. Values are HSL triplets without the hsl() wrapper (for example 225 91% 59%) so you can write hsl(var(--primary)) or hsl(var(--primary) / 0.5) for alpha.

See Getting Started for importing that stylesheet alongside h2o-library/dist/index.css.

Quick theming

  1. Load the library tokens once near your app root (already covered in Getting Started).
  2. Override variables in your own CSS: set light defaults under :root and dark defaults under .dark (or any selector you use for dark mode).
  3. Toggle dark mode the same way as Tailwind’s darkMode: ['class']: add or remove the dark class on <html> (or a wrapper that wraps themed UI).
/* app/globals.css — example only */
:root {
  --primary: 225 91% 59%;
  --background: 0 0% 98%;
}

.dark {
  --primary: 225 85% 62%;
  --background: 0 0% 7%;
}

No rebuild of the library is required — components read the variables at runtime.

Radius tokens

Non-color layout tokens live in the same file: --radius-sm, --radius-md, --radius-lg, --radius-full. Override them alongside colors if you want rounder or sharper corners globally.

Tailwind in your app

Map the same CSS variables into tailwind.config or globals.css (tailwind V4), (for bg-primary, text-muted-200, etc.).

Tailwind is not required to use the library.

Opacity modifiers

The library uses alpha-modified colors for interactive states, overlays, as the tokens are shipped as HSL triplets without the hsl() wrapper. Use hsl(var(--primary) / 0.5) to apply 50% opacity, for example.

  • The Opacity examples section below has interactive swatches to help you visualize how that works in practice.
  • tailwind's built-in opacity modifiers (for example bg-primary/50) work too, as long as you have the variables mapped in your config.

Palette reference

Swatches reflect your current theme on this site. Click a swatch or button to copy. Headings below match the semantic groups in the library stylesheet.

Primary

Brand-blue scale powering interactive elements, CTAs, and focus indicators.

primary-disabled

L225 100% 88%
D225 50% 35%

primary-muted

L221 100% 95%
D221 40% 18%

primary

L225 91% 59%

primary-200

L225 100% 43%

primary-300

L225 91% 40%

primary-400

L225 91% 18%

primary-foreground

L220 33% 96%
D0 0% 3.9216%

Success

Green scale for positive feedback, confirmations, and healthy status indicators.

success-bg

L143 26% 86%
D143 26% 15%

success

L130 35% 46%

success-200

L130 76% 26%

success-300

L130 100% 18%

Warning

Amber scale for caution states, pending items, and advisory messages.

warning-bg

L45 100% 84%
D45 80% 15%

warning

L45 100% 61%

warning-200

L45 100% 45%

warning-300

L45 100% 32%

Destructive

Red scale for errors, destructive actions, and critical alerts.

destructive-bg

L357 100% 92%
D357 60% 18%

destructive

L0 83% 60%

destructive-200

L0 100% 42%

destructive-300

L0 100% 29%

Neutral / Muted

Grayscale tokens for borders, dividers, placeholder text, and subtle surfaces. Values change in dark mode.

muted-25

L0 0 98%
D0 0% 14%

muted-50

L0 0% 96%
D0 0% 18%

muted

L0 0% 80%
D0 0% 40%

muted-200

L0 0% 67%
D0 0% 55%

Surface & layout

Semantic page and container tokens from the library stylesheet. All are theme-aware.

background

L0 0% 96%
D0 0% 1.9608%

foreground

L0 0% 0.3922%
D0 0% 98.0392%

card

L48 33% 97%
D0 0% 3.9216%

popover

L0 0% 100%
D0 0% 9%

border

L0 0% 89%
D0 0% 15.6863%

input

L0 0% 98%
D0 0% 7.0588%

Tailwind quick reference

Examples from this documentation app — your project may map variables differently. Common utility prefixes: bg-, text-, border-, ring-, and so on.

TokenCSS variableCommon usesPreview
primary--primarybg-, text-, border-
primary-foreground--primary-foregroundtext-
primary-disabled--primary-disabledbg-
primary-200--primary-200bg-, text-
background--backgroundbg-
foreground--foregroundtext-
muted--mutedbg-, text-, border-
card--cardbg-
popover--popoverbg-
border--borderborder-, divide-
input--inputbg-

Opacity examples

Interactive swatches using bg-primary with alpha:

/100
/75
/50
/30
/20
/10
/5

bg-primary/100 · bg-primary/75 · bg-primary/50 · bg-primary/30 · bg-primary/20 · bg-primary/10 · bg-primary/5