Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Manipulate colors with chroma.js — convert between color spaces (RGB, HSL, LAB, LCH), generate palettes and scales, mix and blend colors, check contrast ratios, and build accessible color systems. Use when tasks involve creating color palettes, theming, accessibility checks, or data visualization color scales.
.claude/skills/terminalskills-chromajs/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 23% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 7% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 22% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -44% | 0% |
| case-05 | ✗→✓ | ▲ Improved | -58% | 0% |
Color manipulation library for JavaScript. Handles conversions, scales, blending, and WCAG contrast calculations.
bash# Install chroma.js — works in Node and browser. npm install chroma-js npm install -D @types/chroma-js
typescript// src/colors/basics.ts — Create colors, convert between spaces, adjust properties. import chroma from "chroma-js"; // Parse from any format const red = chroma("#ff0000"); const blue = chroma("rgb(0, 0, 255)"); const green = chroma(120, 1, 0.5, "hsl"); // Convert between formats console.log(red.hex()); // "#ff0000" console.log(red.rgb()); // [255, 0, 0] console.log(red.hsl()); // [0, 1, 0.5] console.log(red.lab()); // [53.23, 80.11, 67.22] // Adjust properties const lighter = red.brighten(2); const muted = red.desaturate(1.5); const translucent = red.alpha(0.5);
typescript// src/colors/scales.ts — Build continuous color scales for data visualization. // Scales interpolate between stops and can output any number of discrete colors. import chroma from "chroma-js"; // Two-stop scale const heatScale = chroma.scale(["#fafa6e", "#2A4858"]).mode("lch"); console.log(heatScale(0.5).hex()); // midpoint color // Multi-stop diverging scale const diverging = chroma .scale(["#d73027", "#ffffbf", "#1a9850"]) .mode("lab") .domain([-1, 0, 1]); // Generate 7 discrete colors from a scale const palette = chroma.scale(["#fce4ec", "#880e4f"]).colors(7);
typescript// src/colors/accessibility.ts — Check WCAG contrast ratios between foreground // and background colors. Returns ratio and pass/fail for AA and AAA. import chroma from "chroma-js"; export function checkContrast(fg: string, bg: string) { const contrast = chroma.contrast(fg, bg); return { ratio: Math.round(contrast * 100) / 100, aa: contrast >= 4.5, aaLarge: contrast >= 3, aaa: contrast >= 7, }; } // Find the best text color for a given background export function autoTextColor(bg: string): string { return chroma(bg).luminance() > 0.45 ? "#000000" : "#ffffff"; }
typescript// src/colors/palette.ts — Generate harmonious palettes from a base color // using color theory (complementary, triadic, analogous). import chroma from "chroma-js"; export function generatePalette(base: string, type: "complementary" | "triadic" | "analogous") { const [h, s, l] = chroma(base).hsl(); const shifts: Record<string, number[]> = { complementary: [0, 180], triadic: [0, 120, 240], analogous: [-30, 0, 30], }; return shifts[type].map((shift) => chroma.hsl((h + shift + 360) % 360, s, l).hex() ); } // Bezier interpolation for smoother multi-color palettes const smooth = chroma.bezier(["#f00", "#ff0", "#0f0"]).scale().colors(9);
typescript// src/colors/blending.ts — Mix two colors in a given color space. // LAB mixing produces more perceptually uniform results than RGB. import chroma from "chroma-js"; const mixed = chroma.mix("#ff0000", "#0000ff", 0.5, "lab"); console.log(mixed.hex()); // perceptual midpoint // Average multiple colors const avg = chroma.average(["#ddd", "#ff0", "#09f"], "lab");
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-13 | pass→pass | 10,147 | 3,868 | -62% | 1 | 1 | 0% | 2,421 | 1,830 | -24% | 0 | 0 | — |
case-01 | fail→pass | 6,855 | 4,157 | -39% | 1 | 1 | 0% | 1,580 | 1,942 | +23% | 0 | 0 | — |
case-02 | fail→pass | 10,101 | 6,349 | -37% | 1 | 1 | 0% | 2,160 | 2,314 | +7% | 0 | 0 | — |
case-03 | fail→pass | 8,040 | 5,045 | -37% | 1 | 1 | 0% | 1,705 | 2,081 | +22% | 0 | 0 | — |
case-04 | fail→pass | 13,309 | 4,010 | -70% | 1 | 1 | 0% | 3,140 | 1,744 | -44% | 0 | 0 | — |
case-05 | fail→pass | 18,753 | 3,110 | -83% | 1 | 1 | 0% | 3,903 | 1,645 | -58% | 0 | 0 | — |
case-06 | pass→pass | 11,787 | 4,704 | -60% | 1 | 1 | 0% | 2,329 | 1,937 | -17% | 0 | 0 | — |
case-07 | pass→pass | 13,331 | 3,206 | -76% | 1 | 1 | 0% | 2,695 | 1,600 | -41% | 0 | 0 | — |
case-08 | pass→pass | 16,364 | 2,658 | -84% | 1 | 1 | 0% | 3,557 | 1,642 | -54% | 0 | 0 | — |
case-09 | fail→pass | 9,123 | 3,229 | -65% | 1 | 1 | 0% | 2,143 | 1,656 | -23% | 0 | 0 | — |
case-10 | fail→pass | 15,015 | 1,908 | -87% | 1 | 1 | 0% | 3,414 | 1,382 | -60% | 0 | 0 | — |
case-11 | fail→pass | 23,760 | 2,483 | -90% | 1 | 1 | 0% | 5,968 | 1,514 | -75% | 0 | 0 | — |
case-12 | fail→pass | 16,111 | 3,418 | -79% | 1 | 1 | 0% | 4,375 | 1,692 | -61% | 0 | 0 | — |
case-14 | pass→pass | 6,325 | 2,940 | -54% | 1 | 1 | 0% | 1,213 | 1,582 | +30% | 0 | 0 | — |
case-15 | fail→pass | 5,535 | 4,872 | -12% | 1 | 1 | 0% | 1,079 | 1,982 | +84% | 0 | 0 | — |
case-16 | pass→pass | 8,005 | 2,213 | -72% | 1 | 1 | 0% | 585 | 1,399 | +139% | 0 | 0 | — |
case-17 | pass→pass | 3,701 | 1,957 | -47% | 1 | 1 | 0% | 538 | 1,355 | +152% | 0 | 0 | — |
case-18 | pass→pass | 5,442 | 1,458 | -73% | 1 | 1 | 0% | 975 | 1,267 | +30% | 0 | 0 | — |
case-19 | pass→pass | 6,119 | 2,157 | -65% | 1 | 1 | 0% | 1,039 | 1,411 | +36% | 0 | 0 | — |
case-20 | pass→pass | 3,107 | 2,283 | -27% | 1 | 1 | 0% | 553 | 1,418 | +156% | 0 | 0 | — |
case-21 | pass→pass | 3,001 | 2,013 | -33% | 1 | 1 | 0% | 449 | 1,323 | +195% | 0 | 0 | — |
case-22 | pass→pass | 3,820 | 3,007 | -21% | 1 | 1 | 0% | 726 | 1,650 | +127% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +45 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.