jpskill.com
🎨 デザイン コミュニティ

leonardo-colors

Adobe Leonardoのコントラストカラーを活用し、WCAGアクセシビリティに配慮した、見やすく使いやすいカラーテーマやパレットを構築、調整、提案することで、デザインの品質向上を支援するSkill。

📜 元の英語説明(参考)

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.

🇯🇵 日本人クリエイター向け解説

一言でいうと

Adobe Leonardoのコントラストカラーを活用し、WCAGアクセシビリティに配慮した、見やすく使いやすいカラーテーマやパレットを構築、調整、提案することで、デザインの品質向上を支援するSkill。

※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o leonardo-colors.zip https://jpskill.com/download/9690.zip && unzip -o leonardo-colors.zip && rm leonardo-colors.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9690.zip -OutFile "$d\leonardo-colors.zip"; Expand-Archive "$d\leonardo-colors.zip" -DestinationPath $d -Force; ri "$d\leonardo-colors.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して leonardo-colors.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → leonardo-colors フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1

📖 Skill本文(日本語訳)

※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。

Leonardo Contrast Colors — Agent Skill

@adobe/leonardo-contrast-colors を使用してユーザーを支援する場合は、以下の手順に従ってください。完全な API の詳細(パラメータ、型、セッター)については、必要に応じて references/api.md をロードしてください。

1. インストール

npm i @adobe/leonardo-contrast-colors

ESM (推奨):

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

2. Color と BackgroundColor の作成

BackgroundColor

テーマごとに 1 つ。背景と、ターゲットのコントラスト比でのグレースケール(またはその他の中間色)のスケールを定義します。

const gray = new BackgroundColor({
  name: 'gray',
  colorKeys: ['#cacaca'],   // 補間するキーを 1 つ以上
  ratios: [2, 3, 4.5, 8]   // ターゲットのコントラスト比 (正の値は背景より暗い)
});

Color (前景)

特定のコントラスト比でセマンティックな色(例:青、赤)を定義します。

const blue = new Color({
  name: 'blue',
  colorKeys: ['#5CDBFF', '#0000FF'],  // 色空間で補間
  colorspace: 'LCH',                  // オプション; デフォルト 'RGB'
  ratios: [3, 4.5]                    // 例:大きいテキスト (3:1)、通常のテキスト (4.5:1)
});

パラメータ:

  • name — 出力名のプレフィックスとして使用されます(例:blue100blue200)。
  • colorKeys — CSS カラー文字列の配列。スケールはそれらの間で補間されます。
  • colorspace (または colorSpace) — 補間空間: 'LCH', 'LAB', 'RGB', 'HSL', 'HSV', 'HSLuv', 'CAM02', 'CAM02p', 'OKLAB', 'OKLCH'。デフォルト 'RGB'
  • ratios — 数値の配列(例:[3, 4.5, 7])またはカスタム名を比率にマッピングするオブジェクト(例:{ 'blue--largeText': 3, 'blue--normalText': 4.5 })。
  • smooth — オプションのブール値。補間のためのベジェスムージング(デフォルト false)。
  • output — オプションの出力形式(デフォルト 'HEX')。通常は Theme によってオーバーライドされます。

負の比率 — 背景よりも明るい色(例:ダークモードのテキスト)には、負の値(例:-1.5-3)を使用します。負の値の名前付けには、小数刻み(例:gray25、gray50)を使用します。

3. Theme の作成

1 つの BackgroundColor と 1 つ以上の Color を、明度とオプションのコントラスト/彩度と組み合わせます。

const theme = new Theme({
  colors: [gray, blue, red],   // gray は BackgroundColor; blue, red は Color
  backgroundColor: gray,       // 必須; BackgroundColor インスタンスである必要があります
  lightness: 97,               // 0–100; 背景の明度 (例: 97 = 明るい, 8 = 暗い)
  contrast: 1,                 // オプション; すべての比率の乗数 (デフォルト 1)
  saturation: 100,            // オプション; 0–100 (デフォルト 100)
  output: 'HEX',               // オプション; デフォルト 'HEX'
  formula: 'wcag2'             // オプション; 'wcag2' (デフォルト) または 'wcag3' (APCA)
});

注: colors には、最初の要素として同じ BackgroundColor を含める(または少なくともリストに含める)必要があります。さらに、すべての前景 Color を含める必要があります。Theme では、backgroundColor がその BackgroundColor インスタンスに設定されている必要があります。

4. テーマ出力の読み取り

3 つのゲッター:

  • theme.contrastColors — 配列: 最初の要素 { background: '#...' }、次に namevalues: [{ name, contrast, value }] を持つ色ごとのオブジェクト。デザイントークンまたは CSS 変数生成に使用します。
  • theme.contrastColorPairs — フラットなオブジェクト: { gray100: '#e0e0e0', blue100: '#b18cff', ... }。クイックルックアップに使用します。
  • theme.contrastColorValues — 色文字列のみのフラットな配列。

CSS 変数の反復例:

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. ランタイムでのテーマの変更

構築後、以下を変更できます。

  • theme.lightness = 8 — 例:暗い背景に切り替えます。
  • theme.contrast = 1.2 — グローバルにコントラストを上げます。
  • theme.saturation = 80 — 彩度を下げます。
  • theme.output = 'RGB' — 出力形式を変更します。
  • theme.backgroundColor = otherBackgroundColor — 背景を交換します (BackgroundColor インスタンスを渡します)。
  • theme.colors = [gray, blue, red, green] — 色リストを置き換えます。

色の追加/削除/更新:

  • theme.addColor = newColor — Color インスタンスを追加します。
  • theme.removeColor = { name: 'red' } または theme.removeColor = redColorInstance — 名前またはインスタンスで削除します。
  • theme.updateColor = { name: 'red', ratios: [3, 4.5, 7] } — 名前で色の比率(または colorKeys、name など)を更新します。

セッターの後に、theme.contrastColors(またはペア/値)を再度読み取ります。これらはアクセス時に計算されます。

6. ユーティリティ関数

  • contrast(foregroundRgbArray, backgroundRgbArray, baseV?, method?) — コントラスト比を返します。method: 'wcag2' (デフォルト) または 'wcag3'。RGB 配列は [r, g, b] (0–255) です。完全なテーマを構築せずに 2 つの色を確認するために使用します。
  • convertColorValue(colorString, format, object?) — サポートされている任意の色文字列を format (例: 'HEX', 'RGB', 'LCH') に変換します。object === true の場合、文字列の代わりにチャネルオブジェクトを返します。
  • luminance(r, g, b) — sRGB の相対輝度 (0–1)。
  • createScale({ swatches, colorKeys, colorSpace?, shift?, fullScale?, smooth?, distributeLightness?, sortColor?, asFun? }) — 補間されたスケールを構築します (コントラストのターゲット設定なし)。asFun: true でない限り、色の文字列の配列を返します (スケール関数を返します)。アクセス可能なパレット以外の場合や、キー間のステップに役立ちます。

7. 一般的なアクセシビリティレシピ

  • WCAG 2 AA (通常のテキスト) — 最小 4.5:1。ratios: [4.5] を使用するか、比率に 4.5 を含めます。
  • WCAG 2 AAA (通常のテキスト) — 最小 7:1。ratios: [7] を使用するか、7 を含めます。
  • WCAG 2 大きいテキスト — 最小 3:1。ratios: [3] を使用するか、大きいテキストトークンに 3 を含めます。
  • WCAG 2 AA + 大きいテキストratios: [3, 4.5] を使用し、必要に応じてオブジェクトを介して名前を付けます: { 'brand--large': 3, 'brand--normal': 4.5 }
  • WCAG 3 / APCAformula: 'wcag3' を設定します。

(原文がここで切り詰められています)

📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開

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.