Shade Gen User Guide
A workflow guide for @auric-artisan/shade-gen: OKLCH shade ramps, token presets,
accessibility metrics, deterministic datasets, design-system exports and the public Shade Library.
Overview
A workflow guide for @auric-artisan/shade-gen : OKLCH shade ramps, token presets, accessibility metrics, deterministic datasets, design-system exports and the public Shade Library.
1. What Shade Gen does
+Shade Gen creates tokenized shade systems from a base color or deterministic seed. It works in OKLCH, clips chroma back into displayable sRGB, preserves the requested base token by default and reports WCAG contrast against black and white for every generated shade.
- Package:
@auric-artisan/shade-gen. - Main entry:
tool/shade-gen/src/index.js. - High-level API:
tool/shade-gen/src/api/api.js. - Public library: Shade Library.
- Site data:
data/shade-gen/shades.json,preview.json,preview.cssandindex.json.
Use Shade Gen when you need a design-token scale, not just a list of colors. It is tuned for UI palettes where light tokens, base tokens, dark tokens, contrast and export formats all need to line up.
2. Install and run
+Shade Gen is an ESM package and requires Node 20 or newer.
cd tool/shade-gen
npm run example:basic
npm test
| Command | Purpose |
|---|---|
npm run example:basic |
Generates a brand shade scale, prints score, CSS variables and Tailwind output. |
npm run example:export |
Exports a small batch to JSON, NDJSON, CSV, CSS, SCSS, Tailwind and SVG. |
npm run example:large |
Runs a larger deterministic dataset generation example. |
npm run generate:data |
Writes site-facing files under data/shade-gen. |
npm test |
Runs the Node test suite in tests/shade.test.js. |
3. Choose a shade method
+
generateShadeScale() accepts method, base,
steps, seed, index, tokens,
preserveBase and includeMetrics.
| Method | Use When |
|---|---|
oklch-ramp |
You want a direct perceptual tint-to-shade ramp. |
brand-system |
You need a polished product color scale with moderate hue drift. |
accessible-ui |
You want stronger contrast coverage and calmer chroma. |
neutral-system |
You need gray, slate or low-chroma UI surfaces from a colored base. |
material-like |
You want Material-style light and dark steps with familiar UI spacing. |
tailwind-like |
You want Tailwind-style token naming and a web-design color ladder. |
vivid-product |
You want saturated product or campaign scales. |
duotone-shift |
You want a large hue drift across the scale. |
temperature-shift |
You want a warmer-to-cooler or cooler-to-warmer shade journey. |
ink-paper |
You need very low-chroma text and surface scales. |
Pass method: "mixed" for deterministic datasets. Mixed mode chooses methods by
weighted probability, favoring brand-system, accessible-ui and
tailwind-like.
4. Choose tokens and steps
+Shade Gen supports 2 to 64 colors per scale. Built-in token presets are optimized for common design systems.
| Steps | Tokens |
|---|---|
2 |
light, dark |
3 |
light, base, dark |
5 |
100, 300, 500, 700, 900 |
7 |
50, 100, 300, 500, 700, 900, 950 |
9 |
50 through 950, skipping some middle values. |
10 |
0, 10, 20 through 90 |
11 |
50, 100, 200 through 950 |
13 |
0, 50, 100 through 1000 |
| Other counts | Generated numeric tokens from 000 to 1000. |
By default the base color is placed at token 500, base or
50 if one exists, otherwise near the middle of the scale. Override with
baseIndex on createShadeScale() or pass custom tokens when integrating with an existing
design system.
5. Generate a shade scale
+import {
generateShadeScale,
evaluateShade,
shadeCSS,
shadeTailwind
} from "./src/index.js";
const scale = generateShadeScale({
base: "#d3af37",
method: "brand-system",
steps: 11,
seed: 20260526
});
console.log(scale.steps.map((step) => `${step.token}: ${step.hex}`));
console.log(evaluateShade(scale).score);
console.log(shadeCSS(scale, { prefix: "auric-gold" }));
console.log(shadeTailwind(scale, { name: "auricGold" }));
A generated scale contains shade_id, name, base,
method, tokens, steps and metadata. Every
step includes HEX, RGB, OKLCH, luminance, contrast against white and black, token, index, role
and gamut-clipping metadata.
{
"shade_id": "shade_000000",
"name": "Brand System #D3AF37 #00001",
"base": { "hex": "#d3af37", "token": "500" },
"method": "brand-system",
"tokens": ["50", "100", "200", "300", "400", "500", "600", "700", "800", "900", "950"],
"steps": [
{
"token": "50",
"hex": "#fff6e3",
"rgb": [255, 246, 227],
"oklch": [0.975, 0.027, 85.664],
"contrast": { "white": 1.075, "black": 19.544 },
"role": "tint"
}
],
"metadata": {
"base_index": 5,
"step_count": 11,
"preserve_base": true,
"score": 0.5687
}
}
6. Read the metrics
+
evaluateShade(scale) returns a quality report for the scale.
| Metric | Meaning |
|---|---|
deltaE_ok |
Adjacent OKLab distance values, summary stats and uniformity. |
luminance |
Relative luminance summary and monotonicity across the scale. |
chroma |
OKLCH chroma distribution across the ramp. |
contrast.white, contrast.black |
Contrast stats for each step against white or black. |
contrast.coverage |
Counts of tokens that pass AA or AAA against white, black or either text color. |
hue.travel_degrees |
Total hue movement across the scale. |
gamut.clipped_steps |
How many requested OKLCH colors needed chroma reduction to fit sRGB. |
score |
Weighted quality score based on uniformity, monotonicity, accessibility, clipping and luminance range. |
Treat score as a sorting and QA signal. Still check the actual token pair you plan to use, especially for UI text, state colors and data visualization labels.
7. Use the Shade Library
+
The public Shade Library browses the generated shade dataset with
the same interaction model as the Palette Library. It loads /data/shade-gen/shades.json
and normalizes compact records in the browser.
- Browse 8,192 generated shade systems.
- Search by shade id, name, base, method, token or HEX.
- Filter by method, hue bucket, chroma and lightness.
- Sort by original order, lightness, chroma, hue, score, token count or random order.
- Inspect token colors with HEX, RGB, OKLCH, CIE Lab and WCAG contrast.
- Use Harmony, Accessibility and Stats tabs for analytics on the filtered results.
- Export selected scales as HEX, CSS, SCSS, Tailwind, JSON, SVG, PNG or design tokens.
- Export the filtered results as JSON, compact JSON, CSV, CSS, SCSS, HEX list or Tailwind fragments.
- Save shade systems to browser storage and the Auric Artisan Library workspace mirror.
Current site data uses expanded compact records like
{ id, n, b, m, t, c, s }, where n is name, b is base,
m is method, t is tokens, c is colors and
s is score. The dataset index file describes count, seed, format and available
methods.
8. Export design tokens
+import { generateShadeBatch, exportDataset } from "./src/index.js";
const scales = generateShadeBatch(8, {
seed: 20260526,
method: "mixed",
steps: 11
});
await exportDataset(scales, "./output/shades.json", "json", { pretty: true });
await exportDataset(scales, "./output/shades.ndjson", "ndjson");
await exportDataset(scales, "./output/shades.csv", "csv");
await exportDataset(scales, "./output/shades.css", "css");
await exportDataset(scales, "./output/shades.scss", "scss");
await exportDataset(scales, "./output/shades.tailwind.js", "tailwind");
await exportDataset(scales, "./output/shades.svg", "svg");
| Format | Use For |
|---|---|
json |
Compact or full shade records for application data. |
ndjson |
Line-oriented large data exports. |
csv |
Spreadsheet review of ids, bases, methods, tokens, colors and score. |
css |
CSS custom properties such as --auric-gold-500. |
scss |
SCSS variables for Sass-based design systems. |
tailwind |
Tailwind color extension fragments. |
svg |
Visual strips for review, docs or asset previews. |
9. Generate datasets
+
Use ShadeDatasetGenerator or generateShadeDataset() to write
deterministic datasets without holding every scale in memory.
import { generateShadeDataset } from "./src/index.js";
const result = await generateShadeDataset({
shadeCount: 8192,
outputPath: "./output",
format: "json",
mode: "compact",
method: "mixed",
steps: "mixed",
seed: 20260514,
batchSize: 10000,
includeMetrics: true
});
The site data script writes the public data files:
cd tool/shade-gen
node scripts/generate-data.js --count 8192 --format json
node scripts/generate-data.js --count 8192 --format compact
node scripts/generate-data.js --count 50000 --format ndjson --progress true
shades.jsonis the main public shade dataset or manifest, depending on format.preview.jsoncontains the first 64 site-friendly shade systems.preview.csscontains CSS variables for preview shades.index.jsonrecords count, seed, format, method, steps and available methods.README.mddocuments the generated data folder.
Compact manifest mode writes only deterministic settings and count. Rehydrate slices with
hydrateShadeManifest(manifest, { offset, limit }). Expanded JSON mode writes the
current { id, n, b, m, t, c, s } records consumed by the Shade Library.
10. Use Auric Artisan API paths
+The API layer imports Shade Gen directly for generation, metadata, GraphQL and export routes.
POST /v1/shade/scalereturns a generated shade scale.POST /v1/shade/exportexports a scale as CSS, SCSS, Tailwind or SVG.GET /v1/methods/shadereturns shade methods and step presets.POST /v1/graphqlexposes theshadeScaleresolver.shade-datasetjobs route to the dataset API for bounded job generation.
The HTTP scale endpoint currently accepts method, seed,
steps and hue. The package API also supports base,
index, custom tokens and preserveBase, so prefer direct package usage
for full control.
11. Good practice and limits
+- Use
brand-systemortailwind-likefor general product scales. - Use
accessible-uiwhen text contrast coverage matters most. - Use
neutral-systemorink-paperfor surfaces, text, borders and subtle UI scaffolding. - Use
preserveBase: truewhen a brand color must remain exact at the base token. - Use custom
tokenswhen integrating with an existing naming scheme. - Review
gamut.clipped_stepsif a vivid base color produces dull edge colors. - Use
includeMetrics: falsefor faster bulk generation when score data is not needed. - Run tests after changing token presets, OKLCH conversion, method settings, exports or dataset shape.
For implementation details, see the Shade Gen Developer Reference.