Communitygithub.com

oklch-팔레트-공식

UI의 중립 팔레트(배경, 표면, 선, 텍스트)를 OKLCH 공식으로 구축하거나 마이그레이션합니다. 수십 개의 수동 선택된 16진수 값 대신 몇 가지 입력값으로 구동되며, 밝은 테마와 어두운 테마, 단계별 래더 오버라이드, 기존 색상을 재현하는 피트 스크립트, 브라우저 대비 감사를 포함합니다. 테마 생성, 다크 모드 추가, 제품 색조 변경, 텍스트 대비 감사, 여러 앱의 팔레트 통합 시 사용하세요.

oklch-팔레트-공식란 무엇인가요?

이 스킬은 제품의 중립 색상 팔레트를 OKLCH 색 공간 기반의 수학적 공식으로 변환합니다. 기존에는 수십 개의 16진수 값을 수동으로 선택해야 했지만, 이제는 `--hue`, `--lightness`, `--chroma` 또는 `--contrast` 세 가지 입력값만으로 모든 색상을 구동할 수 있습니다. 밝은 테마와 어두운 테마를 기본으로 지원하며, 각 테마별로 래더(계단) 구조를 사용해 명도 단계를 정의하므로 대비 관계가 항상 유지됩니다. `fit_palette.py` 스크립트를 통해 기존 16진수 팔레트를 공식에 맞게 피팅하고 ΔE(색차)를 출력하며, `palette-audit.mjs`로 실제 브라우저에서 모든 토큰의 WCAG 대비를 자동 검증할 수 있습니다. Tailwind v4의 `@theme`과 호환되며, Claude Code, Cursor 등 다양한 AI 에이전트 플랫폼에서 사용할 수 있습니다.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/Adamparishspok/skills/tree/HEAD/skills/oklch-palette-formula

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

OKLCH 팔레트 공식

제품의 중립 색상(페이지 배경, 카드 표면, 웰스, 헤어라인, 네 단계의 텍스트)은 일반적으로 테마당 15~30개의 16진수 값으로 구성되며 수동으로 선택됩니다. 이 값들은 시간이 지나면서 일관성이 없어지고, 다크 모드는 또 다른 수동 선택 세트가 필요하며, 어떤 쌍이 여전히 대비를 통과하는지 아무도 모릅니다. 이제 공식으로 대체하세요:

표면류 토큰:  L = paper + depth  × n(token)     chroma = tint      hue = hue
잉크 토큰:    L = ink   + step   × n(token)     chroma = ink-tint  hue = hue

n(token)은 토큰이 래더 상에 있는 위치입니다. 각 테마마다 하나의 래더가 있습니다. 하나의 입력값을 변경하면 전체 램프가 함께 움직이므로, 대비가 결정되는 단계 간의 간격이 유지됩니다. 제품의 색조를 변경하는 것은 한 줄(--hue)만 수정하면 됩니다.

세 개의 노브(--hue, --lightness, --chroma 또는 --contrast)가 모든 색상을 구동합니다.

파일

  • references/palette.css: 시작 입력값과 래더가 포함된 즉시 사용 가능한 규칙.
  • scripts/fit_palette.py: 기존 16진수 팔레트에 입력값을 피팅하고 토큰별 ΔE를 출력합니다.
  • scripts/ladders.json: 기본 래더(밝음, 어두움).
  • scripts/palette-audit.mjs: 실제 브라우저에서 두 테마의 모든 토큰을 분석하고 대비를 검증합니다.
  • scripts/oklch.py: 변환 및 ΔE / WCAG 헬퍼.

절차

  1. 토큰을 값이 아닌 역할로 명명합니다. 기본값:

    • 배경류: ground (페이지), panel (레일, 바), surface (카드, 메뉴), surface-2 (웰스), surface-3 (칩, 호버된 행), field.
    • 선: line, line-2, line-3 (헤어라인, 가장 밝은 것부터 가장 어두운 것까지), 그리고 컨트롤의 가장자리인 field-line은 3:1을 충족해야 합니다.
    • 잉크: ink, ink-2, ink-3, ink-4 (텍스트, 가장 어두운 것부터 가장 흐린 것까지). 모든 잉크 단계는 텍스트이므로 각각 4.5:1을 충족해야 합니다.
  2. 다시 고르지 말고 피팅합니다. 기존 제품의 경우 python3 scripts/fit_palette.py theme.css를 실행합니다. 이 스크립트는 --color-* 16진수 선언(밝음 테마, 그다음 [data-theme="dark"] 규칙)을 읽고, 기본 래더에 대해 입력값을 피팅한 후 토큰별 ΔE를 출력합니다. 2 미만이면 시각적으로 동일합니다.

  3. 디자인이 단계 간 간격을 다르게 배치하는 경우 래더 단계를 재정의합니다. 색상을 재정의하지 마세요. fit_palette.py theme.css light '<inputs>' '<overrides>'로 후보를 평가하여 최악의 ΔE가 약 2 미만이 될 때까지 조정합니다. 일반적인 재정의: field: 0 (필드는 카드 면), 더 넓은 line-3, ink와 ink-2 사이의 더 큰 간격.

  4. 규칙을 작성합니다(references/palette.css 참조):

    • 입력값과 --color-* 공식을 테마 속성을 가진 요소에 배치합니다.
    • 다크 규칙에서 변경하는 모든 입력값을 다시 명시합니다. 키트 기본값에 대해 작성된 다크 규칙은 그렇지 않으면 자체 값으로 우선합니다.
    • Tailwind v4에서는 유틸리티가 존재하도록 @theme에 토큰 이름을 유지합니다. 런타임 선언이 이를 재정의합니다.
  5. 실제 브라우저에서 감사합니다: node scripts/palette-audit.mjs <url>. 각 토큰을 렌더링하고 sRGB를 읽어온 후 다음을 확인합니다:

    • 모든 잉크 단계가 모든 배경에 대해 4.5:1을 만족하는지;
    • field-line과 ring이 3:1을 만족하는지.

    실패한 경우 해당 토큰의 래더 단계를 이동하여 수정하고, 색상을 특별 처리하지 마세요. 기존 팔레트에서 실패가 예상됩니다. 17개 앱 마이그레이션에서 감사 결과 절반 이상에서 ink-4 또는 field-line 값이 실패했으며, 이 모든 값은 이전에 출시된 것입니다.

함정

  • var() 내부의 사용자 지정 속성은 선언된 위치에서 해석됩니다.
    • :root에 공식을 선언하고 자식에 입력값을 설정하면 자식은 다시 색칠되지 않습니다.
    • 별칭 토큰(--color-heading: var(--color-ink))도 동일한 테마 요소에 선언되어야 합니다.
  • Tailwind v4 @theme 값은 :root에 있습니다. 앱 루트([data-app])로 범위가 지정된 테마는 @theme이 아닌 해당 위치에 공식을 선언해야 합니다.
  • 캔버스나 맵 라이브러리에 색상을 전달하는 모든 것(getComputedStyle(...).getPropertyValue('--color-x'))은 이제 해석되지 않은 oklch(calc(...)) 문자열을 받습니다. 먼저 해석하세요: 감사가 하는 것처럼 프로브 요소를 그리고 1px 캔버스를 읽습니다.
  • 배경과 잉크의 단일 색조(hue). 디자인상 잉크가 배경과 다른 색조를 가진다면 --ink-tint를 낮게 유지하세요. L 0.98에서 모든 크로마는 색조가 있는 것으로 읽힐 수 있습니다.
  • 브랜드, 상태 및 차트 색상은 공식 밖에 남겨둡니다. 별도로 고르는 대신 동일한 색조에서 고정 명도의 텍스트-온-틴트 변형(예: brand-text)을 파생합니다.
  • 혼합 색조, 밝음 전용 팔레트가 컴프에서 샘플링된 경우 약 2 ΔE 이내로 맞지 않을 수 있습니다. 디자인을 왜곡하지 말고 건너뛰세요. 감사는 여전히 적용됩니다.

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

Adamparishspok/skills

Make a website, web app or online store ready for AI agents. Scan it with Cloudflare's Agent Readiness checks, decide which checks apply to this kind of site, ship the discovery files and headers in priority order, and add the AI-first basics the scanner does not score (server-rendered content, JSON-LD, llms.txt). Covers robots.txt AI rules, Content Signals, sitemap, Markdown for Agents (Accept text/markdown), Link headers, API catalog, OAuth discovery, auth.md, MCP server card, A2A agent card, agent skills index, WebMCP, and commerce protocols (ACP, UCP, AP2, MPP, x402). Use when making a site AI-ready, agent-ready or AI-first, or fixing an isitagentready.com or Cloudflare Agent Readiness report. Triggers on: AI ready, agent ready, AI-first, agent readiness, isitagentready, AI Crawl Control, Markdown for Agents, text/markdown, llms.txt, GPTBot, ClaudeBot, AI crawlers, Content-Signal, ai-train, api-catalog, .well-known, oauth-protected-resource, auth.md, MCP server card, agent card, agent skills, WebMCP, a...

Adamparishspok/skills

Install a complete, lean favicon set on any website or web app — the five files modern browsers, iOS and Android actually use, one block of head markup added once in the root layout, and a check that every file resolves. Covers finding the public folder per framework, generating the set from one SVG (or from a RealFaviconGenerator package), dark-mode SVG icons, maskable manifest icons, cache busting and verification. Use when adding, replacing or auditing a favicon, app icon, apple-touch-icon or web manifest. Triggers on: favicon, favicon.ico, favicon.svg, apple-touch-icon, site.webmanifest, manifest.json, app icon, PWA icon, maskable icon, tab icon, RealFaviconGenerator.

Adamparishspok/skills

Give an interface one shared tempo and a small vocabulary of hover and state micro-interactions: duration tiers (tap/pop/hover/card/layout) for CSS and Motion, swap hand-offs, rows whose highlight grows in, trailing arrows, chevron nudges, card lifts without translate, scroll-edge fades, and icon/label swaps for copy and toggle buttons. Use when animations feel inconsistent, durations are scattered magic numbers, hovers only change colour, or a product feels flat or unfinished. Triggers on: animation duration, transition timing, hover state, micro-interaction, polish, copy button feedback, menu icon to close, back arrow, card hover, scroll fade, motion tokens, Framer Motion durations.

Adamparishspok/skills

Consolidate several apps or prototypes onto one shared component library without flattening their looks. Covers finding duplicated local components (buttons, selects, fields, modals, pagers, toasts), making shared components token-sized so each suite or app sets its own measurements, mapping variant names, deciding what stays app-specific, and the tailwind-merge traps that silently break custom tokens. Use when several apps each grew their own Btn/Select/Modal, when a design system's components "don't fit" a second product, or when retheming a family of apps. Triggers on: shared component library, design system consolidation, duplicate components, retheme, suite of apps, shadcn retokened, token-driven components, cn tailwind-merge custom tokens, variant mapping.

관련 스킬