MCPInstall

leonardo-colors

Generate accessible color themes using @adobe/leonardo-contrast-colors. Use when the user needs help building contrast-based color palettes, checking WCAG accessibility, creating adaptive themes, or using the Leonardo API.

Installs
53
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/adobe/leonardo --skill leonardo-colors
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads leonardo-colors automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

Leonardo Contrast Colors — Agent Skill

When helping users with @adobe/leonardo-contrast-colors, follow these steps. For full API details (parameters, types, setters), load references/api.md on demand.

1. Installation

npm i @adobe/leonardo-contrast-colors

ESM (recommended):

import { Theme, Color, BackgroundColor, contrast, convertColorValue, luminance, createScale } from '@adobe/leonardo-contrast-colors';

2. Creating Color and BackgroundColor

BackgroundColor

One per theme. Defines the background and the scale of grays (or other neutrals) at target ratios.

const gray = new BackgroundColor({
  name: 'gray',
  colorKeys: ['#cacaca'],   // one or more keys to interpolate
  ratios: [2, 3, 4.5, 8]   // target contrast ratios (positive = darker than background)
});

Color (foreground)

Defines a semantic color (e.g. blue, red) at specific contrast ratios.

const blue = new Color({
  name: 'blue',
  colorKeys: ['#5CDBFF', '#0000FF'],  // interpolated in colorspace
  colorspace: 'LCH',                  // optional; default 'RGB'
  ratios: [3, 4.5]                    // e.g. large text (3:1), normal text (4.5:1)
});

Parameters:

  • name — Used to prefix output names (e.g. blue100, blue200).
  • colorKeys — Array of CSS color strings; the scale is interpolated between them.
  • colorspace (or colorSpace) — Interpolation space: 'LCH', 'LAB', 'RGB', 'HSL', 'HSV', 'HSLuv', 'CAM02', 'CAM02p', 'OKLAB', 'OKLCH'. Default 'RGB'.
  • ratios — Either an array of numbers (e.g. [3, 4.5, 7]) or an object mapping custom names to ratios (e.g. { 'blue--largeText': 3, 'blue--normalText': 4.5 }).
  • smooth — Optional boolean; bezier smoothing for interpolation (default false).
  • output — Optional output format (default 'HEX'); usually overridden by Theme.

Negative ratios — Use negative values (e.g. -1.5, -3) for colors lighter than the background (e.g. text on dark mode). Naming for negatives uses fractional increments (e.g. gray25, gray50).

3. Creating a Theme

Combine one BackgroundColor and one or more Colors with a lightness and optional contrast/saturation.

const theme = new Theme({
  colors: [gray, blue, red],   // gray is BackgroundColor; blue, red are Color
  backgroundColor: gray,       // required; must be the BackgroundColor instance
  lightness: 97,               // 0–100; background lightness (e.g. 97 = light, 8 = dark)
  contrast: 1,                 // optional; multiplier for all ratios (default 1)
  saturation: 100,            // optional; 0–100 (default 100)
  output: 'HEX',               // optional; default 'HEX'
  formula: 'wcag2'             // optional; 'wcag2' (default) or 'wcag3' (APCA)
});

Note: colors should include the same BackgroundColor as the first element (or at least include it in the list) plus all foreground Colors. The Theme requires backgroundColor to be set to that BackgroundColor instance.

4. Reading theme output

Three getters:

  • theme.contrastColors — Array: first element { background: '#...' }, then one object per color with name and values: [{ name, contrast, value }]. Use for design tokens or CSS variable generation.
  • theme.contrastColorPairs — Flat object: { gray100: '#e0e0e0', blue100: '#b18cff', ... }. Use for quick lookups.
  • theme.contrastColorValues — Flat array of color strings only.

Example iteration for CSS variables:

for (const item of theme.contrastColors) {
  if (item.background) {
    document.documentElement.style.setProperty('--background', item.background);
  } else {
    for (const v of item.values) {
      document.documentElement.style.setProperty(`--${v.name}`, v.value);
    }
  }
}

5. Mutating a theme at runtime

After construction you can change:

  • theme.lightness = 8 — e.g. switch to dark background.
  • theme.contrast = 1.2 — increase contrast globally.
  • theme.saturation = 80 — reduce saturation.
  • theme.output = 'RGB' — change output format.
  • theme.backgroundColor = otherBackgroundColor — swap background (pass BackgroundColor instance).
  • theme.colors = [gray, blue, red, green] — replace color list.

Adding/removing/updating colors:

  • theme.addColor = newColor — Add a Color instance.
  • theme.removeColor = { name: 'red' } or theme.removeColor = redColorInstance — Remove by name or by instance.
  • theme.updateColor = { name: 'red', ratios: [3, 4.5, 7] } — Update a color’s ratios (or colorKeys, name, etc.) by name.

After any setter, re-read theme.contrastColors (or pairs/values); they are computed on access.

6. Utility functions

  • contrast(foregroundRgbArray, backgroundRgbArray, baseV?, method?) — Returns contrast ratio. method: 'wcag2' (default) or 'wcag3'. RGB arrays are [r, g, b] (0–255). Use to check two colors without building a full theme.
  • convertColorValue(colorString, format, object?) — Convert any supported color string to format (e.g. 'HEX', 'RGB', 'LCH'). If object === true, returns channel object instead of string.
  • luminance(r, g, b) — Relative luminance (0–1) for sRGB.
  • createScale({ swatches, colorKeys, colorSpace?, shift?, fullScale?, smooth?, distributeLightness?, sortColor?, asFun? }) — Build an interpolated scale (no contrast targeting). Returns array of color strings unless asFun: true (returns scale function). Useful for non-accessible palettes or stepping between keys.

7. Common accessibility recipes

  • WCAG 2 AA (normal text) — Minimum 4.5:1. Use ratios: [4.5] or include 4.5 in ratios.
  • WCAG 2 AAA (normal text) — Minimum 7:1. Use ratios: [7] or include 7.
  • WCAG 2 large text — Minimum 3:1. Use ratios: [3] or include 3 for large text tokens.
  • WCAG 2 AA + large text — Use ratios: [3, 4.5] and name via object if desired: { 'brand--large': 3, 'brand--normal': 4.5 }.
  • WCAG 3 / APCA — Set formula: 'wcag3' on Theme. Interpret APCA Lc values per WCAG 3 guidance; the library returns Lc for contrast when method is 'wcag3'.

Recommendation: Prefer LCH or LAB for interpolation (colorspace: 'LCH') for perceptually even scales.

8. Supported colorspaces and output formats

Interpolation colorspaces (Color/BackgroundColor colorSpace, createScale):
LCH, LAB, RGB, HSL, HSV, HSLuv, CAM02, CAM02p, OKLAB, OKLCH.

Output formats (Theme output, Color output, convertColorValue):
HEX, RGB, HSL, HSV, HSLuv, LAB, LCH, CAM02, CAM02p, OKLAB, OKLCH.

Values follow W3C CSS Color Module Level 4 (e.g. lch(100% 0 360deg), rgb(255 255 255)).


For full parameter tables, setter lists, and type details, see references/api.md.

FAQ

What does the leonardo-colors skill do?

Generate accessible color themes using @adobe/leonardo-contrast-colors. Use when the user needs help building contrast-based color palettes, checking WCAG accessibility, creating adaptive themes, or using the Leonardo API.

How do I install leonardo-colors?

Run npx skills add https://github.com/adobe/leonardo --skill leonardo-colors in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/leonardo-colors/ (personal) or .claude/skills/leonardo-colors/ (project).

Which AI agents can use leonardo-colors?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is leonardo-colors safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains leonardo-colors?

It is published by adobe in adobe/leonardo. It has 53 recorded installs.

Popular frontend & design skills

View category →

setup-matt-pocock-skills

mattpocock/skills

Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.

Frontend & Design1.1M installs

frontend-design

anthropics/skills

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

OfficialFrontend & Design1M installs

hyperframes-animation

heygen-com/hyperframes

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.

prototype

mattpocock/skills

Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.

Frontend & Design999.2K installs

hyperframes-core

heygen-com/hyperframes

The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.

Frontend & Design930.5K installs

vercel-react-best-practices

vercel-labs/agent-skills

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

OfficialFrontend & Design843.1K installs