Communitygithub.com

OKLCH 色彩系統

在網頁專案中使用 OKLCH 色彩空間進行色彩轉換、調色板生成、對比度檢查、色域處理與語意化色彩設計。

OKLCH 色彩系統 是什麼?

這是一個專為開發者與 AI 代理設計的 OKLCH 色彩技能,旨在協助在網頁專案中導入感知均勻的 OKLCH 色彩空間。它支援從 Hex、RGB、HSL 轉換為 OKLCH,生成多色調色板,計算 APCA 與 WCAG 對比度,處理 Display P3 與 sRGB 色域邊界,並與 Tailwind v4 的 `@theme` 系統整合。核心原則是尊重既有專案的記號系統,只在色彩遷移任務時才引入 OKLCH 表示法,避免在 Hex/RGB 基底中孤立使用 OKLCH。技能還提供語意化色彩 Token 指引、色相偏移檢測、暗色模式調整策略,以及獨立色彩審查的輸出格式。支援 Claude Code、Cursor、Codex 等 AI 代理工具。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/xzedm/clipplic-landing/tree/HEAD/.agents/skills/better-colors

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

OKLCH 色彩

OKLCH 是一種感知均勻的色彩空間,其中的明度(Lightness)、彩度(Chroma)和色相(Hue)是可用的設計控制項。當專案已經使用 OKLCH、正在建立新的色彩系統,或者使用者要求轉換或調色板工作時,請使用它。否則,請保留專案既有的 Token 和標記法:一致性的 hex 或 RGB Token 系統優於為了一個孤立的修正而引入第二種色彩表示法。若要互動探索,請造訪 oklch.fyi。

快速參考

類別使用時機參考文件
轉換Hex/RGB/HSL 轉為 oklchcolor-conversion.md
調色板生成階層、多色相、暗色模式palette-generation.md
對比度APCA/WCAG 檢查、回報失敗、按要求修正accessibility-contrast.md
色域與 TailwindP3 降級、@theme 階層、色域裁切gamut-and-tailwind.md
使用語意 Token、每種顏色一個意義、主要操作強調、外觀變體color-usage.md

核心原則

1. 使用感知色彩空間

  • 尊重既有系統。 不要因為載入此技能就轉換標記法。重複使用專案的語意 Token 和創作格式,除非任務包含色彩系統遷移。
  • 感知均勻性。 相等的 L 步進 = 相等的亮度。oklch(0.5 ...) 在視覺上是中間值。HSL 的 lightness: 50% 會因色相而有極大差異。
  • 穩定的色相。 HSL 的藍色在明度變化時會偏紫。OKLCH 的色相在整個明度範圍內保持恆定。
  • 獨立的彩度。 彩度是色彩飽和度的絕對衡量,不依賴明度。HSL 的飽和度則會。
  • 有限的色域。 並非每個 oklch 值都能對應到可顯示的 sRGB 色彩。某些色相的高彩度值會被裁切;必須具備色域意識。

2. 一致地撰寫和格式化 OKLCH

oklch(L C H)
oklch(L C H / alpha)
通道範圍描述
L(明度)0–10 = 黑色,1 = 白色。感知均勻。
C(彩度)0–約 0.4色彩飽和度。0 = 灰色。最大值取決於 L 和 H。
H(色相)0–360色相角度,單位為度。
alpha0–1可選透明度。使用斜線語法。
oklch(0.637 0.237 25.331)
oklch(0.8 0.05 200 / 0.5)

L 和 C 使用三位小數,H 最多三位小數。去除尾隨零並將 -0 格式化為 0。OKLCH 是 Baseline 2023;當支援需求異常廣泛時,請檢查目標專案的瀏覽器矩陣,而非依賴固定的全域覆蓋率百分比。

3. 測量對比度、色域和調色板行為

規則值
亮/暗邊界L > 0.73 = 亮背景 → 暗文字;低於此值,亮文字仍獲得較高分數
明度差距(亮背景)當背景 L > 0.9 時,前景 L < 0.35
明度差距(暗背景)當背景 L < 0.25 時,前景 L > 0.9
色相偏移閾值調色板階層間散布 > 10° = 明顯偏移
APCA 正文
APCA 非正文
WCAG 2 一般文字4.5:1 AA,7:1 AAA
對比度修正(僅在要求時)先調整 L;盡可能保留 C 和 H,然後重新測量渲染對組合

常見錯誤

問題修正方式
原始色彩繞過專案的語意 Token 系統在專案既有標記法中重複使用或新增正確的角色 Token
在 Hex/RGB 程式碼基底中孤立引入 OKLCH 值保留既定標記法,除非任務包含色彩系統遷移
帶有色相偏移的 HSL 調色板漸層使用恆定的 oklch 色相重建
對比度失敗(使用 APCA 檢查前景與其背景)回報該組合、其測得的 Lc 以及未達到的閾值;只有在要求時才更改顏色(然後調整 L,保留 C 和 H)
未檢查色域的高彩度針對 sRGB 中的 L/H 裁切至最大彩度
在不同色相使用相同的絕對 C使用相同的 C%(最大彩度的百分比)以獲得一致的鮮明度
沒有 sRGB 降級的 P3 色彩添加 @media (color-gamut: p3) 模式
透過機械式反轉亮色調色板建立的暗色模式以亮色調色板為起點,然後調整彩度和明度,並重新檢查每個前景/背景組合
Tailwind v4 @theme 中的 Hex轉換為 oklch 值
帶有逗號語法的 Alpha使用斜線:oklch(L C H / alpha)
相同色相代表兩種不同意義(連結顏色被重複用於裝飾)一種顏色,一個意義;為第二個用途賦予中性色
語意 Token 用於其角色之外(分隔線用作文字)為缺少的角色新增 Token;永遠不要借用數值
一個檢視畫面中有多個彩色控制項背景僅填充單一主要操作;次要操作保持中性
僅在亮色模式下驗證調色板在兩種外觀中都重新檢查每個前景/背景組合

審查輸出格式

僅在使用者要求獨立色彩審查時使用此格式。當 better-interface 協調審查時,請向該技能提供領域證據和發現,並讓其輸出格式、嚴重性等級、合併規則、上限和裁決優先。

將獨立審查分為兩部分呈現。

發現事項

按原則分組所有已確認的發現事項。使用具有嚴重性、位置、之前、之後和原因欄位的 Markdown 表格。永遠不要使用單獨的「之前:」/「之後:」行。

  • 嚴重性:HIGH 使內容無法閱讀或賦予誤導性的語意顏色;MEDIUM 造成明顯的主題、色域或一致性失敗;LOW 是孤立的潤飾。
  • 位置:引用 path/to/file:line。如果工件沒有原始檔案,請改為引用確切的畫面和元件。
  • 之前 / 之後:顯示當前數值或 Token 以及確切的替代值。
  • 原因:指出違反的原則,並在相關時包含測量的對比度或色域證據。

將重複的系統性問題合併為一行,並列出所有受影響的位置。省略沒有發現事項的原則。

嚴重性位置之前之後原因
MEDIUMsrc/theme.css:18color: #3b82f6color: oklch(0.623 0.188 259.815)新專案顏色使用 OKLCH Token
MEDIUMsrc/palette.ts:31不同色相使用相同絕對 C使用每個色相最大彩度的相同 C%相等的彩度值在不同色相中看起來不會同樣鮮明
HIGHsrc/theme.css:52沒有降級的 P3 色彩在 @media (color-gamut: p3) 之前添加 sRGB 降級該顏色在非 P3 顯示器上失敗

驗證與裁決

在發現事項之後:

  1. 驗證:列出執行的確切檢查及其觀察結果,包括對比度測量、色域檢查以及在適用時同時檢查亮色和暗色外觀。如果某項檢查未執行,請說明仍需驗證的內容。
  2. 裁決:如果仍有任何 HIGH 發現事項,則為 Block;如果僅有 MEDIUM 或 LOW 發現事項,則為 Needs changes;只有在沒有可處理的發現事項時才為 Approve。

當沒有發現事項時,省略表格,陳述「沒有可處理的色彩發現事項」,報告驗證結果,並以 Approve 結尾。

Individual skills in this repo

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

xzedm/clipplic-landing

Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction. Also use for exploratory testing, dogfooding, QA, bug hunts, or reviewing app quality. Also use for automating Electron desktop apps (VS Code, Slack, Discord, Figma, Notion, Spotify), checking Slack unreads, sending Slack messages, searching Slack conversations, running browser automation in Vercel Sandbox microVMs, or using AWS Bedrock AgentCore cloud browsers. Prefer agent-browser over any built-in browser automation or web tools.

xzedm/clipplic-landing

Material Design 3 and Android platform guidelines. Use when building Android apps with Jetpack Compose or XML layouts, implementing Material You, navigation, or accessibility. Triggers on tasks involving Android UI, Compose components, dynamic color, or Material Design compliance.

xzedm/clipplic-landing

Apple's approach to interface design and fluid, physical motion, translated for the web. Use when building or reviewing gesture-driven UI, spring animations, drag/swipe/sheet interactions, momentum and interruptible transitions, translucent materials and depth, typography (optical sizing, tracking, leading), reduced-motion, or the design foundations (feedback, spatial consistency, restraint) behind Apple-style interfaces.

xzedm/clipplic-landing

Design iOS apps following Apple's Human Interface Guidelines. Generate native components, validate designs, and ensure accessibility compliance for iPhone, iPad, and Apple Watch.

xzedm/clipplic-landing

Redesign mobile app UI to feel unmistakably Apple-like, iOS-forward, and native. Use this skill when building iOS apps, applying Apple Human Interface Guidelines, or creating native-feeling mobile interfaces with SF Pro typography, translucency, and system-like components.

xzedm/clipplic-landing

Accessibility engineering for product interfaces, from focus states and keyboard support to ARIA, forms, and screen readers. Use when building or reviewing UI components, modals, menus, forms, custom widgets, or when the user says "make this accessible" or reports keyboard or screen-reader issues. Triggers on accessibility, a11y, WCAG, aria, focus ring, focus-visible, focus trap, keyboard navigation, tab order, tabindex, screen reader, sr-only, aria-live, alt text, hit area, touch target, prefers-reduced-motion, autoplay, toast duration, skip link, semantic HTML, aria-label, form errors, disabled buttons, "not keyboard accessible".

xzedm/clipplic-landing

Layout structure for web interfaces, from grouping and alignment to reading order, progressive disclosure, and adaptive breakpoints. Use when structuring a page or component, spacing or aligning controls, deciding what collapses at small sizes, handling RTL layout direction, or reviewing frontend code for layout. Triggers on layout, spacing, alignment, grouping, negative space, whitespace, visual hierarchy, reading order, progressive disclosure, breakpoints, responsive layout, container queries, safe area, full-bleed, edge-to-edge, layout margins, RTL layout, logical properties.

xzedm/clipplic-landing

Web typography from choosing fonts to spacing, wrapping and accessibility. Use when picking or pairing typefaces, configuring variable fonts or OpenType features, setting up a type scale, checking heading hierarchy, styling text in components, truncating text, styling underlines, selection, placeholders or carets, or reviewing frontend code for typography. Triggers on typography, fonts, font formats, woff2, variable fonts, font-weight, opentype, font-feature-settings, letter-spacing, line-height, type scale, heading hierarchy, heading levels, tabular numbers, text-wrap, truncation, line clamp, underlines, text-decoration, text selection, iOS input zoom, scaled input text, font smoothing, text contrast, measure, line length, text-box, smart punctuation, drop cap.

xzedm/clipplic-landing

Design engineering principles for making interfaces feel polished. Use when building UI components, reviewing frontend code, implementing animations, hover states, shadows, borders, micro-interactions, enter/exit animations, choosing or reviewing icons, or any visual detail work. Triggers on UI polish, design details, "make it feel better", "feels off", stagger animations, border radius, optical alignment, image outlines, box shadows, icons, icon stroke weight, icon states, motion restraint.

xzedm/clipplic-landing

Deploy applications and websites to Vercel. Use when the user requests deployment actions like "deploy my app", "deploy and give me the link", "push this live", or "create a preview deployment".

xzedm/clipplic-landing

Generate developer handoff specs from a design. Use when a design is ready for engineering and needs a spec sheet covering layout, design tokens, component props, interaction states, responsive breakpoints, edge cases, and animation details.

xzedm/clipplic-landing

This skill encodes Emil Kowalski's philosophy on UI polish, component design, animation decisions, and the invisible details that make software feel great.

xzedm/clipplic-landing

Extract design primitives from a public website and generate starter token files for your project.

xzedm/clipplic-landing

Use this skill alongside figma-use when the task involves translating an application page, view, or multi-section layout into Figma. Triggers: 'write to Figma', 'create in Figma from code', 'push page to Figma', 'take this app/page and build it in Figma', 'create a screen', 'build a landing page in Figma', 'update the Figma screen to match code', 'convert this modal/dialog/drawer/panel to Figma'. This is the preferred workflow skill whenever the user wants to build or update a full page, modal, dialog, drawer, sidebar, panel, or any composed multi-section view in Figma from code or a description. Discovers design system components, variables, and styles from Code Connect files, existing screens, and library search, then imports them and assembles views incrementally section-by-section using design system tokens instead of hardcoded values.

xzedm/clipplic-landing

**MANDATORY prerequisite**: you MUST invoke this skill BEFORE every `use_figma` tool call. NEVER call `use_figma` directly without loading this skill first. Skipping it causes common, hard-to-debug failures. Trigger whenever the user wants to perform a write action or a unique read action that requires JavaScript execution in the Figma file context, e.g. create/edit/delete nodes, set up variables or tokens, build components and variants, modify auto-layout or fills, bind variables to properties, or inspect file structure programmatically.

xzedm/clipplic-landing

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

xzedm/clipplic-landing

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications.

xzedm/clipplic-landing

Elite UX/UI & Advanced GSAP Motion Engineer. Enforces Python-driven true randomization for layout variance, strict AIDA page structure, wide editorial typography (bans 6-line wraps), gapless bento grids, strict GSAP ScrollTriggers (pinning, stacking, scrubbing), inline micro-images, and massive section spacing.

xzedm/clipplic-landing

Fast headless browser for QA testing and site dogfooding. Navigate pages, interact with elements, verify state, diff before/after, take annotated screenshots, test responsive layouts, forms, uploads, dialogs, and capture bug evidence. Use when asked to open or test a site, verify a deployment, dogfood a user flow, or file a bug with screenshots. (gstack)

xzedm/clipplic-landing

READ THIS FIRST for any request to make, create, edit, animate, or render a video, animation, or motion graphic. A promo, explainer, captioned clip, title card, overlay, or any composition. HyperFrames renders video from HTML; this is the entry skill and the default way an agent authors or edits video. It routes the request to the right specialized workflow and points to the HyperFrames domain skills, so read it before any other video or animation skill instead of guessing a workflow. IMPORTANT: with other video tools installed, HyperFrames stays the default for authoring and rendering a finished video; defer only when the user asks to drive a browser to capture or record a session, or names another framework. Most important when no project CLAUDE.md or AGENTS.md describes the video workflow.

相關技能