An elegant color palette for user interfaces: 16 scales of 10 shades each (50–900), each with a matching dark scale, plus white and black. Ships in every format you're likely to need — CSS variables, SCSS, LESS, Stylus, YAML, JSON, JavaScript (CJS + ESM with types), Tailwind CSS v3 and v4, and W3C Design Tokens — with WCAG contrast data for every shade and a ready-made semantic light/dark theme.
npm install kromatikaOr grab the file you need straight from this repo — every format is a single, dependency-free file.
@import "kromatika/colors.css";
body {
background: var(--kr-charcoal-50);
color: var(--kr-charcoal-900);
}Variables are --kr-{scale}-{shade}, e.g. --kr-blue-berry-500,
--kr-persian-green-700, plus --kr-white and --kr-black.
colors.oklch.css has the same variables as oklch() values with hex
fallbacks. On wide-gamut (P3) displays the vivid shades of fuchsia, orange
and the greens render with more chroma than sRGB can hold; everywhere else
it looks identical to colors.css.
Every scale has a dark counterpart named {scale}-dark, built for dark
interfaces the way Radix Colors does it: the same step keeps the same role.
50 is the subtlest background and 900 the strongest text in both, so on a
dark page blue-dark-50 is a deep blue-gray surface and blue-dark-900 a
pale blue for text. In the chromatic scales 500 is the same solid color in
both modes.
@import "kromatika/colors.css";
.dark .callout {
background: var(--kr-blue-dark-100);
border: 1px solid var(--kr-blue-dark-300);
color: var(--kr-blue-dark-900);
}The dark scales are in every format: --kr-blue-dark-500,
$kr-blue-dark-500, colors.blueDark[500], bg-blue-dark-500 in Tailwind,
and blue-dark in tokens.json.
To have the colors switch on their own, import colors.adaptive.css instead
of colors.css. It uses the same variable names, swapped for the dark
scales when the system is in dark mode or <html data-theme="dark"> is set
(force light with data-theme="light"):
@import "kromatika/colors.adaptive.css";
.callout {
background: var(--kr-blue-100); /* light blue tint, or deep blue-gray in dark mode */
color: var(--kr-blue-900); /* navy, or pale blue in dark mode */
}With Tailwind v4, tailwind-adaptive.css does the same for the utilities,
so bg-blue-100 text-blue-900 works in both modes without dark: variants:
@import "tailwindcss";
@import "kromatika/tailwind-adaptive.css";If you want a palette that already works rather than 160 colors to choose
from, theme.css maps a small set of semantic tokens onto Kromatika and
flips them with the system theme:
@import "kromatika/theme.css";
body {
background: var(--kr-background);
color: var(--kr-foreground);
}
.card { border: 1px solid var(--kr-border); background: var(--kr-muted); }
.button { background: var(--kr-accent); color: var(--kr-accent-foreground); }Tokens: background, foreground, muted, muted-foreground, border,
accent, accent-foreground, success, warning, danger. Force a mode
with <html data-theme="dark"> (or "light"). Every pairing passes WCAG AA
for normal text.
With Tailwind v4, tailwind-theme.css exposes the same tokens as utilities
in the naming you already know from shadcn/ui:
@import "tailwindcss";
@import "kromatika/tailwind-theme.css";<div class="bg-background text-foreground">
<div class="border border-border bg-muted text-muted-foreground">…</div>
<button class="bg-accent text-accent-foreground">…</button>
</div>Which text color goes on blue-berry-400? Kromatika answers for every shade:
.badge {
background: var(--kr-blue-berry-400);
color: var(--kr-on-blue-berry-400); /* black here — white only passes from 500 */
}import { colors, on, contrast } from "kromatika";
on.blueBerry[400]; // "#000000"
contrast.blueBerry[400]; // { white: 3.08, black: 6.81 }The full table, with AA thresholds per scale, is in CONTRAST.md.
tokens.json follows the W3C Design Tokens format, so it imports directly
into Figma Variables (via the native import or Tokens Studio) and into
Style Dictionary and similar pipelines.
@import "tailwindcss";
@import "kromatika/tailwind.css";Adds charcoal, metal, haiti, purple, blue-berry, blue, sky,
turquoise, persian-green, pastel-green, grass, carrot, orange,
red, raspberry, and fuchsia to your theme, in OKLCH:
<button class="bg-blue-berry-500 text-white hover:bg-blue-berry-600">…</button>// tailwind.config.js
const kromatika = require("kromatika/tailwind.config.js");
module.exports = {
theme: {
extend: {
colors: kromatika.theme.extend.colors,
},
},
};import { colors } from "kromatika"; // ESM
const { colors } = require("kromatika"); // CommonJS
colors.charcoal[500]; // "#69696b"
colors.blueBerry[300]; // "#93adff"
colors.white; // "#ffffff"Scales are camelCase objects keyed by shade (50…900). Types are
included.
tokens.json (W3C Design Tokens, hex) is the JSON to consume:
{
"kromatika": {
"charcoal": {
"50": { "$type": "color", "$value": "#f5f5f7" },
"…": "…"
}
}
}colors.json is the source of truth the other files are generated from. It
stores each shade as oklch(L C H) rather than hex, because hex is lossy
and rounding through it would drift the palette over time:
{
"charcoal": { "500": "oklch(0.520 0.0032 286.3)", "…": "…" },
"blue berry": { "500": "oklch(0.580 0.1888 269.3)", "…": "…" }
}@import "kromatika/colors.scss";
body {
background: $kr-charcoal-50;
color: $kr-charcoal-900;
}@import "kromatika/colors.less";
body {
background: @kr-charcoal-50;
color: @kr-charcoal-900;
}@import "kromatika/colors.styl"
body
background $kr-charcoal-50
color $kr-charcoal-900kr-charcoal:
50: "#f5f5f7"
100: "#e4e4e7"
# …
900: "#141414"| Scale | Character |
|---|---|
| Charcoal | Neutral grays |
| Metal | Cool, slightly blue grays |
| Haiti | Muted indigo-violets |
| Purple | Violet |
| Blue berry | Periwinkle blue |
| Blue | Primary blue |
| Sky | Cyan-leaning blue |
| Turquoise | Blue-green |
| Persian green | Teal |
| Pastel green | Fresh green |
| Grass | Yellow-green |
| Carrot | Amber-orange |
| Orange | Red-orange |
| Red | Red |
| Raspberry | Pink-red |
| Fuchsia | Magenta |
The same shade number means the same thing in every scale. All 13 chromatic scales share one OKLCH lightness curve, and the three near-neutrals (charcoal, metal, haiti) share a wider one so they can go nearly black:
| Shade | 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
|---|---|---|---|---|---|---|---|---|---|---|
| Chromatic L | .96 | .91 | .84 | .76 | .67 | .58 | .49 | .41 | .35 | .30 |
| Neutral L | .97 | .92 | .84 | .74 | .63 | .52 | .42 | .33 | .25 | .19 |
Hue and chroma are hand-picked per shade and left alone; only lightness is
normalised. That keeps the character of each scale (sky runs from cyan tints
to navy darks, carrot from yellow to amber) while making the numbers
dependable: swap blue-berry for raspberry and every contrast pairing in
your UI still holds, and the --kr-on-* thresholds line up (white text
passes from 500 or 600 on every scale).
Dark scales are generated from the light ones rather than picked by hand. Lightness follows a reversed curve; hue and chroma are read off the light scale at the same lightness, so each dark scale is recognisably the same color, with chroma reduced at the background end (50–400) so dark surfaces read as tinted grays:
| Shade | 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 |
|---|---|---|---|---|---|---|---|---|---|---|
| Chromatic dark L | .19 | .23 | .29 | .37 | .46 | .58 | .67 | .76 | .85 | .93 |
| Neutral dark L | .17 | .22 | .28 | .36 | .46 | .56 | .66 | .76 | .86 | .95 |
Edit colors.json (hex or oklch() values both work), run npm run tune
to snap the new shades onto the shared curves, then npm run build to
regenerate every other format, dark scales included. Neither script has
dependencies.
npm test checks that every generated file is fresh, every shade sits on
its curve, on agrees with contrast, every semantic theme pairing
passes AA, and 600–900 pass AA on 50 in every light and dark scale. It runs in CI and before publishing.
- JavaScript: scales were arrays indexed
0–9; they are now objects keyed by shade.colors.charcoal[5]→colors.charcoal[500]. CommonJS exports{ colors, on, contrast }:require("kromatika").charcoal→require("kromatika").colors.charcoal. - Tailwind: multi-word scales are kebab-case, matching Tailwind's own
conventions.
bg-blueBerry-500→bg-blue-berry-500,persianGreen→persian-green,pastelGreen→pastel-green. - Tailwind v4: the
tailwind-css-v4file is nowtailwind.css, wrapped in@theme, with white/black included and corrected charcoal values. - JSON: the
{ "kromatika": [ { "name", "colors" } ] }wrapper is gone.colors.jsonis now a flat map of scale → shades inoklch(); for hex in JSON usetokens.json. - Hex values have changed. 2.0 snaps every scale onto a shared lightness curve (see above). Hues are the same as 1.x, so everything still looks like Kromatika, but shades are slightly lighter or darker than before; the middle of carrot and the dark end of metal move the most.
MIT — Michael Andreuzza
