Skip to main content
PimentCSS v1.0.1, what's new
Home

Colors

OKLCH palettes with hex fallback, semantic variables, and swatch classes.

Overview

PimentCSS uses a Caribbean / Antilles palette in OKLCH (tokens/colors.css), mapped to components through semantic variables (tokens/semantic.css). Each step exposes a CSS variable and a preview class .palette__chip--*.

PaletteRoleDefault step
primaryLagoon teal, actions, links, focus600
accentSunset mango, highlights500
neutralWarm sand / night, surfaces & text500
informationLagoon cyan, info UI500
success / warning / errorFeedback states500

Prerequisites

  • PimentCSS installed, Installation (npm, CDN, or Sass).
  • OKLCH support, modern browsers; hex fallbacks ship when $enable-hex-fallback is on.
  • Color mode, set data-theme on <html> or use the doc header toggle to validate dark semantics.

Canonical tokens

Edit tokens/colors.css for palette steps, then tokens/semantic.css for how components consume them. Regenerate preview CSS with npm run generate:palettes.

Semantic contrast pairs

Prefer these tokens in components. Each card shows background + foreground with a live contrast ratio (WCAG 2.2 / RGAA: ≥ 4.5:1 for normal text). Failed pairs are outlined in red, adjust semantics, not only raw palette steps.

--surface-page + --text-body (body)
--surface-action + --text-on-action (primary button)
--surface-elevated + --text-body (card)
--surface-information + --text-on-information
--surface-error + --text-error (alert surface)
--error-100 + --error-700 (inline error)
--primary-600 + --neutral-100 (action step)
--border-default border token

OKLCH palettes

Every swatch lists its OKLCH value (canonical source). CSS variable: --{palette}-{step}. Preview class: .palette__chip--{palette}-{step}.

Steps 100–300 suit backgrounds; 600–900 for text on light surfaces. Re-check after theme changes.

Usage in CSS

Use semantic variables in components; reserve raw steps for illustrations or charts.

Live components

Information

Success

Semantic colors applied.

Generate & build

  1. Edit palette source

    Update OKLCH values in tokens/colors.css. Keep light and dark semantic mappings aligned.

    # tokens/colors.css
  2. Regenerate palettes & docs

    Refreshes styles/palettes.css, swatch HTML, and Sass palette maps.

    npm run generate:palettes
  3. Rebuild distribution CSS

    Produces dist/pimentcss.min.css for npm and the documentation site.

    npm run build:css

Accessibility (RGAA / WCAG)

Contrast checklist

  • Normal text, ratio ≥ 4.5:1 (AA). Large text (≥ 18px regular or 14px bold) may use 3:1.
  • Non-text UI, focus rings and control borders ≥ 3:1 against adjacent colors (WCAG 1.4.11).
  • Do not rely on hue alone, pair color with weight, icons, or copy (RGAA thématique 3).
  • Test both modes, toggle light/dark; semantics in tokens/semantic.css must pass in each.

See the full guide on Accessibility. Customize tokens on Customization.

Next steps