color-ops
БесплатноЗапускает вложенные скриптыНе проверенColor for developers: color spaces, accessibility contrast, palette generation, CSS color functions, design tokens, dark mode. Triggers on: color, palette…
от 0xDarkMatter★ 86 звёзд на GitHubОб этом скилле
Color Operations
Practical color knowledge for developers and designers. Covers color spaces, accessibility, palette generation, CSS implementation, and design token architecture.
Inspired by meodai/skill.color-expert - a comprehensive 286K-word color science knowledge base with 113 reference files. This is a lightweight operational skill for everyday frontend and design work. For deep color science (spectral mixing, historical color theory, CAM16, pigment physics), install the full skill.
Color Space Decision Table
Pick the right space for the task. This is the single most impactful color decision you'll make.
| Task | Use | Why |
|---|---|---|
| Perceptual color manipulation | OKLCH | Best uniformity for lightness, chroma, hue |
| CSS gradients & palettes | OKLCH or color-mix(in oklab) |
No mid-gradient grey/brown deadzone |
| Gamut-aware color picking | OKHSL / OKHSV | Cylindrical like HSL but perceptually grounded |
| Normalized saturation (0-100%) | HSLuv | CIELUV chroma normalized per hue/lightness |
| Print workflows | CIELAB D50 | ICC standard illuminant |
| Screen workflows | OKLAB | D65 standard, perceptually uniform |
| Color difference (precision) | CIEDE2000 | Gold standard perceptual distance metric |
| Color difference (fast) | Euclidean in OKLAB | Good enough for most applications |
| Quick prototyping | HSL | Simple, fast, every tool supports it |
Why HSL Falls Short
HSL is fine for quick prototyping. It fails for anything perceptual:
- Lightness is a lie:
hsl(60,100%,50%)(yellow) andhsl(240,100%,50%)(blue) have the same L=50% but vastly different perceived brightness - Hue is non-uniform: 20 degrees near red is a dramatic shift; 20 degrees near green is barely visible
- Saturation doesn't correlate: S=100% dark blue still looks muted
Rule of thumb: Use HSL for throwaway work. Use OKLCH for anything that ships.
Key Distinctions
- Chroma = colorfulness relative to a same-lightness neutral
- Saturation = perceived colorfulness relative to the color's own brightness
- Lightness = perceived reflectance relative to a similarly lit white
- Same chroma != same saturation. These are different dimensions.
Accessibility - Contrast Numbers That Matter
The Odds Are Against You
Of ~281 trillion hex color pairs:
| Threshold | % passing | Odds |
|---|---|---|
| WCAG 3:1 (large text) | 26.49% | ~1 in 4 |
| WCAG 4.5:1 (AA body) | 11.98% | ~1 in 8 |
| WCAG 7:1 (AAA) | 3.64% | ~1 in 27 |
| APCA 60 | 7.33% | ~1 in 14 |
| APCA 75 (fluent reading) | 1.57% | ~1 in 64 |
| APCA 90 (preferred body) | 0.08% | ~1 in 1,250 |
WCAG vs APCA
| WCAG 2.x | APCA (WCAG 3 draft) | |
|---|---|---|
| Model | Simple luminance ratio | Perceptual contrast, polarity-aware |
| Dark-on-light vs light-on-dark | Same ratio | Different - accounts for spatial frequency |
| Text size/weight | Only large vs normal | Continuous scale with font lookup table |
| Accuracy | Known problems with blue, dark mode | Much better perceptual accuracy |
| Status | Current standard, legally referenced | Draft - not yet a requirement |
Practical guidance: Test with WCAG 2.x for compliance. Use APCA for better perceptual results. When they disagree, APCA is usually more accurate.
Quick Contrast Checks
/* Use relative color syntax to auto-generate readable text */
--surface: oklch(0.95 0.02 250);
--on-surface: oklch(from var(--surface) calc(l - 0.6) c h);
/* Or simpler: light surface = dark text, dark surface = light text */
--text: oklch(from var(--surface) calc(1 - l) 0 h);
// Quick WCAG 2.x relative luminance contrast
function contrastRatio(l1, l2) {
const lighter = Math.max(l1, l2);
const darker = Math.min(l1, l2);
return (lighter + 0.05) / (darker + 0.05);
}
function relativeLuminance(r, g, b) {
const [rs, gs, bs] = [r, g, b].map(c => {
c /= 255;
return c <= 0.04045 ? c / 12.92 : ((c + 0.055) / 1.055) ** 2.4;
});
return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
}
Color Vision Deficiency (CVD)
~8% of men and ~0.5% of women have some form of color vision deficiency. Design accordingly.
| Type | Affects | Prevalence | What breaks |
|---|---|---|---|
| Protanopia | Red perception | ~1% men | Red/green distinction, red appears dark |
| Deuteranopia | Green perception | ~1% men | Red/green distinction (most common) |
| Tritanopia | Blue perception | ~0.01% | Blue/yellow distinction (rare) |
Rules:
- Never use color alone to convey information (add icons, labels, patterns)
- Test with CVD simulation tools (see references)
- Red/green is the most dangerous pair - always add a secondary signal
CSS Color Functions - Modern Syntax
Core Functions (Baseline 2024+)
/* OKLCH - the recommended default */
color: oklch(0.7 0.15 150);
Установить color-ops в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
ReadWriteBashВложенные файлы
FAQ
Что делает скилл color-ops?
Color for developers: color spaces, accessibility contrast, palette generation, CSS color functions, design tokens, dark mode. Triggers on: color, palette, contrast, WCAG, APCA, OKLCH, color-mix, dark mode colors, design tokens, CVD, color blind, P3, sRGB.
Как установить скилл color-ops?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл color-ops запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
frontend-design
Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making…
от Anthropicwebapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing…
от Anthropicbrand-guidelines
Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand…
от Anthropicweb-artifacts-builder
Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn/ui). Use…
от Anthropic