Skip to Content

Design Tokens & Theming

A conflict-free --hl-* OKLCH semantic token system supporting automatic light/dark adaptation and custom brand themes.

Design Principles

All visual tokens in @hacline/ui are namespaced under the --hl-* prefix and mapped through Tailwind CSS v4 @theme inline to utility classes such as bg-hl-*, text-hl-*, border-hl-*, rounded-hl-*, and shadow-hl-*, preventing naming collisions with host apps or third-party styles.

Interactive Palette

Click any token card to copy its var(--hl-*) CSS variable, and toggle light/dark mode in the header to inspect perceptual contrast adaptation in real time.

Live Brand Theme & Radius Studio
Brand Primary (--hl-primary)
Radius Scale (--hl-radius-*)
Live Preview (Neutral · Default 0.5rem)
Theme build progress
SuccessWarningDangerInfo
Copy as

Surfaces

Used for page backgrounds, cards, muted panels, and floating popovers.

Foreground & Borders

Maintains clear readable contrast across both light and dark modes.

Brand & Semantic Status

Built on perceptually uniform OKLCH colors for consistent light and dark balance.

Radius & Elevation

Click any card to copy its radius or shadow CSS variable.

Motion & Easing

Click Replay or any card to compare duration and cubic-bezier timing curves.

Z-Index Scale

Predictable stacking layers from dropdowns to top-level toasts.

Dark Mode Switching

Add the .dark class or data-theme="dark" attribute to <html> or any container element and every --hl-* token updates automatically:

<!-- Option 1: Class toggle (recommended for next-themes / Fumadocs) -->
<html class="dark">
  ...
</html>

<!-- Option 2: data-theme attribute toggle -->
<div data-theme="dark">...</div>

Custom Brand Themes

After installing Hacline through the Registry, override the variables in your global stylesheet to customize the light and dark themes.

global.css
@import "tailwindcss";

:root {
  --hl-primary: oklch(0.49 0.21 264);
  --hl-primary-hover: oklch(0.43 0.2 264);
  --hl-primary-fg: oklch(0.985 0 0);
  --hl-radius-md: 0.625rem;
}

.dark {
  --hl-primary: oklch(0.68 0.19 264);
  --hl-primary-hover: oklch(0.74 0.17 264);
  --hl-primary-fg: oklch(0.145 0 0);
}