Getting Started with cssmark

cssmark uses CSS @property rules as the single source of truth for design tokens. Define once, use everywhere.

1. Define your tokens

Create a CSS file with your design tokens using the @property syntax:

@property --color-primary {
  syntax: "<color>";
  inherits: false;
  initial-value: #0055ff;
  description: "Primary brand color";
  category: "color.brand";
  type: "color";
}

2. See them in action

Colors from your tokens
Spacing scale
Using tokens in components

3. Generate outputs

# Generate clean CSS with :root variables (for consumption)
cssmark css ./tokens/**/*.css --out variables.css

# Build JSON output (for tooling/integrations)
cssmark build ./tokens/**/*.css --out tokens.json

# Generate this documentation site
cssmark docs ./tokens/**/*.css --out ./docs

# Validate your tokens
cssmark validate ./tokens/**/*.css

4. Use in your CSS

Import the generated variables.css and use your tokens:

.button {
  background: var(--color-primary);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  box-shadow: var(--shadow-sm);
}

color.background

--color-bg
color
#ffffff

Primary background color for the main content area.

Usage examples
  • background: var(--color-bg)
<color> ./examples/tokens.css:104
--color-bg-secondary
color
#f8f9fa

Secondary background for sidebar, code blocks, and cards.

Usage examples
  • background: var(--color-bg-secondary)
<color> ./examples/tokens.css:115

color.brand

--color-accent
color deprecated
#6366f1

Legacy accent color. Use --color-primary instead.

Aliases: --color-primary
<color> ./examples/tokens.css:494
--color-primary
color
#0055ff

Primary brand color for interactive elements, links, and accents.

Usage examples
  • color: var(--color-primary)
  • border-color: var(--color-primary)
Aliases: --color-action--color-link
<color> ./examples/tokens.css:155

color.primitives

--color-navy-800
color
#2d2d44

Dark navy for dark-mode secondary backgrounds.

<color> ./examples/tokens.css:55
--color-blue-500
color
#0055ff

Core blue for interactive elements.

<color> ./examples/tokens.css:64
--color-blue-400
color
#66aaff

Lighter blue for dark-mode interactive elements.

<color> ./examples/tokens.css:73
--color-red-500
color
#dc3545

Red for error and danger states.

<color> ./examples/tokens.css:82
--color-gray-200
color
#e9ecef

Light gray for borders and dividers.

<color> ./examples/tokens.css:37
--color-white
color
#ffffff

Pure white primitive.

<color> ./examples/tokens.css:10
--color-gray-500
color
#6c757d

Mid gray for secondary text.

<color> ./examples/tokens.css:28
--color-gray-50
color
#f8f9fa

Lightest gray for subtle backgrounds.

<color> ./examples/tokens.css:19
--color-navy-900
color
#1a1a2e

Deep navy for primary text.

<color> ./examples/tokens.css:46
--color-yellow-500
color
#ffc107

Yellow for warnings and caution states.

<color> ./examples/tokens.css:91

color.semantic

--color-danger
color
#dc3545

Danger/error color for destructive actions and error states.

Usage examples
  • color: var(--color-danger)
<color> ./examples/tokens.css:182
--color-warning
color
#ffc107

Warning color for deprecation notices and caution states.

Usage examples
  • background: var(--color-warning)
<color> ./examples/tokens.css:192
--color-border
color
#e9ecef

Default border color for cards, dividers, and inputs.

Usage examples
  • border: 1px solid var(--color-border)
<color> ./examples/tokens.css:171

color.text

--color-text-muted
color
#6c757d

Muted text color for secondary content, captions, and metadata.

Usage examples
  • color: var(--color-text-muted)
<color> ./examples/tokens.css:141
--color-text
color
#1a1a2e

Primary text color for body content.

Usage examples
  • color: var(--color-text)
<color> ./examples/tokens.css:130

effects

--shadow-sm
shadow

Subtle shadow for cards and elevated elements.

Usage examples
  • box-shadow: var(--shadow-sm)
* ./examples/tokens.css:422

layout

--sidebar-width
size
280px

Width of the sidebar navigation.

Usage examples
  • width: var(--sidebar-width)
<length> ./examples/tokens.css:436
--swatch-size
size
24px

Size of color swatch indicators.

Usage examples
  • width: var(--swatch-size)
  • height: var(--swatch-size)
<length> ./examples/tokens.css:466
--content-max-width
size
1200px

Maximum width of the main content area.

Usage examples
  • max-width: var(--content-max-width)
<length> ./examples/tokens.css:446
--card-min-width
size
320px

Minimum width for token cards in the grid.

Usage examples
  • grid-template-columns: repeat(auto-fill, minmax(var(--card-min-width), 1fr))
<length> ./examples/tokens.css:456

radius

--radius-full
size
999px

Full border radius for pills and circular elements.

Usage examples
  • border-radius: var(--radius-full)
<length> ./examples/tokens.css:408
--radius-lg
size
8px

Large border radius for cards and containers.

Usage examples
  • border-radius: var(--radius-lg)
<length> ./examples/tokens.css:398
--radius-sm
size
2px

Small border radius for inline code and subtle rounding.

Usage examples
  • border-radius: var(--radius-sm)
<length> ./examples/tokens.css:378
--radius-md
size
4px

Medium border radius for badges and buttons.

Usage examples
  • border-radius: var(--radius-md)
<length> ./examples/tokens.css:388

spacing

--space-3
size
0.5rem

Small spacing for compact layouts.

Usage examples
  • padding: var(--space-3)
  • gap: var(--space-3)
<length> ./examples/tokens.css:304
--space-9
size
3rem

Extra large spacing for category separations.

Usage examples
  • margin-bottom: var(--space-9)
  • padding: var(--space-9)
<length> ./examples/tokens.css:364
--space-2
size
0.25rem

Extra small spacing for inline elements.

Usage examples
  • padding: var(--space-2)
  • margin-top: var(--space-2)
<length> ./examples/tokens.css:294
--space-7
size
1.5rem

Medium-large spacing for section gaps.

Usage examples
  • gap: var(--space-7)
  • margin-bottom: var(--space-7)
<length> ./examples/tokens.css:344
--space-6
size
1.25rem

Medium spacing for card padding.

Usage examples
  • padding: var(--space-6)
<length> ./examples/tokens.css:334
--space-1
size
0.125rem

Minimal spacing for tight padding.

Usage examples
  • padding: var(--space-1)
<length> ./examples/tokens.css:284
--space-8
size
2rem

Large spacing for major sections.

Usage examples
  • padding: var(--space-8)
  • margin-bottom: var(--space-8)
<length> ./examples/tokens.css:354
--space-4
size
0.75rem

Medium-small spacing for card content.

Usage examples
  • padding: var(--space-4)
  • margin-bottom: var(--space-4)
<length> ./examples/tokens.css:314
--space-5
size
1rem

Base spacing unit.

Usage examples
  • padding: var(--space-5)
  • gap: var(--space-5)
<length> ./examples/tokens.css:324

typography.family

--font-sans
font
Aa Bb Cc 123 The quick brown fox jumps over the lazy dog

Primary sans-serif font stack for body text and UI.

Usage examples
  • font-family: var(--font-sans)
* ./examples/tokens.css:206
--font-mono
font
Aa Bb Cc 123 The quick brown fox jumps over the lazy dog

Monospace font stack for code, token names, and technical content.

Usage examples
  • font-family: var(--font-mono)
* ./examples/tokens.css:216

typography.lineHeight

--line-height-base
number
1.6

Base line height for body text.

Usage examples
  • line-height: var(--line-height-base)
<number> ./examples/tokens.css:480

typography.size

--font-size-base
size
Aa 1rem

Base text size for body content.

Usage examples
  • font-size: var(--font-size-base)
<length> ./examples/tokens.css:250
--font-size-lg
size
Aa 1.25rem

Large text for sidebar headings.

Usage examples
  • font-size: var(--font-size-lg)
<length> ./examples/tokens.css:260
--font-size-xl
size
Aa 1.5rem

Extra large text for section headings.

Usage examples
  • font-size: var(--font-size-xl)
<length> ./examples/tokens.css:270
--font-size-xs
size
Aa 0.75rem

Extra small text for metadata and fine print.

Usage examples
  • font-size: var(--font-size-xs)
<length> ./examples/tokens.css:230
--font-size-sm
size
Aa 0.875rem

Small text for descriptions and secondary content.

Usage examples
  • font-size: var(--font-size-sm)
<length> ./examples/tokens.css:240
Generated by cssmark View on GitHub