Native HTML · No JavaScript · Production Ready

Toky CSS

Style native HTML elements with zero configuration. Just set your brand colors, write semantic markup, and watch everything adapt — dark mode included.

Semantic HTML, Native Styling

Your markup IS your design. Write

OKLCH Color System

Colors that look consistent across all screens and devices.

Automatic Dark Mode

One toggle, perfect dark theme. No extra CSS needed.

Smart Contrast

Text automatically adapts to your brand color for perfect readability.

Alpha Variants

Semi-transparent colors for overlays, borders, and hover effects.

Modern CSS Architecture

Built with @layer, container queries, and relative color syntax.

Wide Gamut Colors

Vivid colors on modern displays, consistent on standard screens.

Intelligent Layouts

Automatic grids and spacing based on your content.

Fluid Typography

Text that scales beautifully from mobile to desktop.

Installation

Add TokyCSS to your project. Choose the method that works best for you.

CDN

Quickest

Add directly to your HTML. Best for quick prototypes or simple projects.

index.html
html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/tokycss@1/dist/toky.min.css">

Other Integrations

index.html
html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>My Site</title>
  <link rel="stylesheet" href="toky.min.css">
</head>
<body>
  <button data-variant="primary">Click me</button>
</body>
</html>
BaseLayout.astro
astro
---
// src/layouts/BaseLayout.astro
import 'tokycss/dist/toky.min.css';
---

<html lang="en">
  <body>
    <slot />
  </body>
</html>

Getting Started

Three steps. No build step required.

1

Link the CSS

‹link rel="stylesheet" href="dist/toky.min.css"›
2

Set Your Brand

/* styleguide.css */
:root {
  --tk-primary:   oklch(0.55 0.27 265);
  --tk-secondary: oklch(0.60 0.16 190);
  --tk-accent:    oklch(0.80 0.18 80);
}
3

Write Semantic HTML

‹button data-variant="primary"›Primary‹/button›
‹div data-status="success"›Done!‹/div›
‹div data-theme="dark"›...dark section...‹/div›

Color System

Every color is generated from brand source colors using Relative Color Syntax. Each scale features 5 tints, 5 shades, and 10 alpha variants.

primary
secondary
accent
neutral

Status Color Palettes

Functional colors for communication, each with a full scale of tints, shades, and alpha variants.

success
warning
danger
info

Typography

A smart scaling system using both Container Queries and Media Queries.

Heading Scale

Heading 1 — The quick brown fox

Heading 2 — The quick brown fox

Heading 3 — The quick brown fox

Heading 4 — The quick brown fox

Heading 5 — The quick brown fox
Heading 6 — The quick brown fox

Inline Elements

You can use bold text, italic text, highlighted text, and small text. Inline code elements get a subtle background.

Press + K to open the command palette.

Design is not just what it looks like. Design is how it works.

Steve Jobs
:root {
  --tk-primary: oklch(0.55 0.27 265);
}

Lists and Details

Unordered
  • OKLCH color system
  • 11-step color scales
Ordered
  1. Import styleguide.css
  2. Set brand colors
  3. Write semantic HTML
What is OKLCH?

OKLCH is a perceptually uniform color space that produces consistent results across lightness steps.

How does dark mode work?

The framework uses the latest CSS standards to automatically switch between light and dark values.

Shadows

Elevation tokens for depth and hierarchy. Use shadows to create visual separation between layers.

xs --tk-shadow-xs
sm --tk-shadow-sm
base --tk-shadow-base
lg --tk-shadow-lg
xl --tk-shadow-xl
2xl --tk-shadow-2xl

Usage

Small shadow (sm)
Large shadow (lg)

Radius

Border radius tokens for consistent corner rounding across your UI.

none 0
xs --tk-radius-xs
sm --tk-radius-sm
base --tk-radius-base
lg --tk-radius-lg
xl --tk-radius-xl
2xl --tk-radius-2xl
3xl --tk-radius-3xl
full --tk-radius-full

Usage

Small radius (sm)
Large radius (lg)
Full radius (full)

Forms

Beautiful, accessible form controls styled automatically.

Text Inputs

Select, Checkbox, Radio

Notifications
Plan

Range, Color, File, Progress

Interactive

Buttons, dialogs, tables, and loading states for native interactivity.

Button Variants

Solid

Primary brand colors

Outline & Ghost

Subtle variants

Sizes

Scale options

Status & Dialogs

Status Indicators

Visual feedback states

Success
Warning
Danger
Info

Dialog

Native HTML dialog element

Confirm Action

Are you sure? This cannot be undone.

Loading State

aria-busy spinner

aria-busy="true" spinner

Table

Data Table

Semantic table styling

Token TypeScale RangeUse CaseContrast Goal
Base Color--tk-color-*Solid componentsHigh
Tints (5)-5xlight to -1xlightSubtle backgroundsAA Large Text
Shades (5)-1xdark to -5xdarkText and IconsAAA Standard
Alphas (10)-1a to -10aOverlays and BordersContextual
Color Token Purpose and Accessibility Mapping

Semantic Tokens

Use these tokens in your CSS — they auto-adapt to light/dark mode.

Backgrounds

--bg-page
Page background
--bg-surface
Card / surface
--bg-subtle
Subtle section
--bg-muted
Muted / disabled

Text

Aa
--fg-default
Primary text
Aa
--fg-muted
Secondary text
Aa
--fg-subtle
Tertiary text

Borders

--border-default
Default border
--border-muted
Subtle border