Communitygithub.com

色彩系統建置與稽核工具

協助你建立與稽核專案的色彩系統,產生色票、命名語意代號,並在格式間轉換與測量對比度。

色彩系統建置與稽核工具 是什麼?

此技能提供一套完整的色彩系統建置與稽核流程。它能根據專案需求自動生成顏色漸層、對應語意代號,並在不同色彩格式(如 hex 與 OKLCH)之間轉換。同時,它會精確測量前景與背景之間的渲染對比度,並根據 WCAG 標準報告失敗的組合。此技能支援多種開發平台(如 Tailwind、Radix 等慣例),並強調保持色相一致性、按角色使用代號,以及確保色彩資訊不只依賴顏色呈現(需搭配圖示或標籤)。透過結構化的報告(HIGH/MEDIUM/LOW 嚴重度)與驗證項目(包含瀏覽器內與非瀏覽器檢測),它協助開發者與設計師維持可及性與 UI 一致性。

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

在你喜歡的 AI 中提問

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

說明文件

色彩系統建置與稽核工具 是做什麼的?

此技能負責建立與稽核色彩系統。它會產生漸層,將色票步驟對應到角色與代號名稱,轉換標記法,並測量渲染後的對比度。

切勿報告未經測量的對比值,也切勿推估你可計算的顏色。標記法、色調中性色與漸層的插值空間是專案選擇,而非發現。角色對應錯誤、失敗的配對與超出色域的步驟,才算發現。全程感知亮度意指 OKLCH 的 L 值,範圍從 0 到 1。

一個配對是否必須通過,屬於 better-accessibility 的範疇。表面、陰影與圖示顏色則歸 better-ui 管理。

符合專案的色彩系統

重複使用專案的代號與標記法。一致的 hex 系統勝過四處散落 oklch() 的 hex。

對於新系統,oklch() 是最佳的預設選項,因為其數字行為符合下方漸層規則的描述。在其他情況下,色彩函式庫應以專案自身的標記法產生相同的漸層(參閱 color-formats.md)。

系統是漸層,而非顏色

只保留一個中性色漸層、一個強調色漸層,以及產品實際渲染的狀態色漸層。一個 warning 漸層如果沒有任何匯入它的元件,等於為零像素做維護。第二個強調色調只有在兩個東西必須一眼就能區分時才值得加入。否則請使用單一強調色漸層的更多步驟。

每個步驟都有任務

漸層不是用肉眼挑選的色票。每個步驟都存在,因為某個角色需要它:頁面背景、元件懸停、邊框、實心填色、正文文字。不要產生任何角色不會用到的步驟。Tailwind 的 50–950 與 Radix 的 1–12 慣例都對應到這些角色(參閱 palette-structure.md)。

以色調命名原始色票,以角色命名語意代號

原始色票命名一個值(--blue-600),且絕不會在元件中使用。語意代號命名一個任務(--color-text-secondary),指向一個原始色票,並且是元件唯一會參考的層級。這個界線讓主題能夠重新對應顏色,而無需觸及元件(參閱 token-naming.md)。

只在角色內使用代號

切勿因為某個代號今天的值符合需求就借用它。一個分隔線若被當作文字顏色使用,在邊界變淡時,文字也會跟著變淡。如果某個角色缺少代號,就新增該代號。

在整個漸層中保持色相

一個漸層從頭到尾保持單一色相,在漸層中段達到彩度高峰,並在亮端以更細的間距分階。使用色彩函式庫建立,切勿用肉眼(參閱 palette-generation.md)。

一種顏色,一種意義

一種顏色在整個介面中只用於一個目的,並將 OKLCH 色相相差 15° 以內的顏色視為同一種顏色(參閱 color-usage.md)。切勿讓顏色成為意義的唯一載體。必須搭配圖示或標籤,這項要求由 better-accessibility 負責。

每個檢視畫面只填滿一個主要動作

當填滿的顏色用來表示主要強調時,只有一個主要動作會使用它,其他同級動作保持中性。將顏色放在背景上,而非標籤上。一個填滿的按鈕在遠處就能被辨識為主要動作;中性按鈕上的強調色文字則看起來像連結。

保留已建立的層級結構,若它已經用其他方式傳達了強調意圖,則可容許多個彩色背景,只要它們代表不同的狀態或分類,而非互為競爭的同級元素。

測量渲染後的配對,然後報告

測量前景與其實際渲染的背景(而非頁面背景)之間的對比。當一個配對失敗時,報告該配對、其測量值以及它未達到的門檻,然後不要改變顏色。顏色是設計決定。只有在被要求時才更改它們,並在更改後重新測量(參閱 contrast.md)。

選擇漸層的插值空間

空間是一種視覺風格,而非正確性設定。預設為 in oklab,當一個雙色調漸層在中間變灰時,使用 in oklch(參閱 color-usage.md)。

完成前檢查

模式修正方式
在元件檔案中直接使用 hex、rgb( 或 oklch( 字面值,而存在對應代號重複使用或新增該角色代號,使用專案的標記法
一個程式碼庫中只有一個 oklch( 值,其餘都是 hex使用已建立的標記法來書寫,除非遷移在範圍內
在元件檔案中使用 var(--blue-600) 或 bg-blue-600讓語意代號指向原始色票,並使用該代號
語明代號包含色調或元件名稱,如 --color-blue-button 或 --color-sidebar-gray依角色重新命名:--color-accent-solid、--color-bg-surface
同時定義了 --color-primary 和 --color-text-primary將品牌代號重新命名為 accent
在 color: 屬性內使用 border 或 separator 代號,或在 background: 內使用 text 代號為缺少的角色新增代號
hsl( 漸層值僅在亮度上不同在 OKLCH 中以固定色相重建
50–200 在 OKLCH L 上的間距與中間步驟一樣大將亮端間距收緊至約 0.04–0.05 每階
每個色調的漸層使用相同的色度或飽和度數值使用每個色調各自最大值的相同比例
狀態色調與強調色調相差小於 15°將其移開至少 15°,或為破壞性動作提供不同的處理方式
深色代號與反向步驟順序的亮色漸層相同降低強調色的色度,加寬深色端,並重新測量每個配對
同時在 prefers-color-scheme 和 .dark class 下設定了顏色代號選擇一種切換機制,並在整個專案中使用
一個對比度修正改變了色相但未改變亮度改變亮度,這是對比度會回應的通道
prefers-contrast: more 在一個區塊中同時覆蓋兩種外觀的顏色為每種外觀分別提供其增強對比的值
在帶有 alpha 的顏色(如 /50、rgba( 或 color-mix( 搭配 transparent)上的文字測量渲染後的結果,或使用實心代號
在 Tailwind 500 填色上的 text-white測量它;白色在大多數 500 色調上無法通過 4.5:1,因此將填色改為 600
oklch() 的色度超出 sRGB 範圍,且前面未宣告 sRGB 值先宣告 sRGB 值,再將鮮豔值放在 @media (color-gamut: p3) 內部

報告格式

嚴重度。 HIGH 表示內容無法閱讀或指定了誤導性的語意顏色。MEDIUM 表示明顯的主題、代號或色域失敗。LOW 表示孤立的潤飾問題。

三種症狀無論表面為何都視為 HIGH,與 better-interface 的升級觸發條件一致:內文或控制項文字其渲染配對未能達到所需比率、僅以顏色傳達狀態或意義,以及使用違背其意義的語意顏色。

驗證。 在無瀏覽器環境下:檢查代號值、每個宣告顏色的色域、兩個主題區塊皆存在,以及從宣告的代號配對計算對比度。在瀏覽器環境下:檢查文字實際渲染的背景(包括透明度及下方任何圖片),在淺色與深色兩種模式下皆需測量。報告你無法執行的每項檢查為 Not verified。

格式。 將發現項目歸類到其違反的原則下方,依嚴重度排序,每行對應一個根本原因並列出所有出現位置:

嚴重度位置修改前修改後原因

位置 為 路徑/至/檔案:行號。原因 說明違反的原則及對使用者的影響。

結尾處若仍有任何 HIGH 則標示 Block;否則標示 Approved,並將其餘項目留在表格中作為待辦事項。切勿對於你未檢查的範圍標示 Approved。若無事項可報告,則標示「無可操作的色彩發現項目」,並報告驗證結果。

Individual skills in this repo

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

LIKELION-CAPSULE/Landing_Page

Reviews and fixes keyboard and focus behavior, ARIA, accessible names, forms, screen-reader announcements, motion and zoom in your project against WCAG 2.2.

LIKELION-CAPSULE/Landing_Page

Combines all of the `better-*` skills into a single review across accessibility, layout, writing, typography, color and UI polish.

LIKELION-CAPSULE/Landing_Page

Helps with grouping, alignment, reading order, responsive structure and room for translated text, so a layout holds up when it is resized, translated or mirrored.

LIKELION-CAPSULE/Landing_Page

Sets and reviews how text renders in your product, from the type scale and spacing to font features, wrapping, truncation and punctuation.

LIKELION-CAPSULE/Landing_Page

Polishes the surfaces, icons and motion in your project with exact values for border radius, optical alignment, shadows, icon states and animation.

LIKELION-CAPSULE/Landing_Page

Writes and reviews your interface copy, from labels and errors to empty states and confirmations, so it matches your product's voice and tells people what to do next.

LIKELION-CAPSULE/Landing_Page

Renders a component you choose under every scenario that can reach it on a temporary page and stress tests it.

LIKELION-CAPSULE/Landing_Page

Try to break a piece of UI by feeding it worst-case data — long names, unbreakable emails, one-letter names, missing fields, huge counts, zero items, long labels, non-Latin text, emoji, extreme numbers — then render it behind a "Demo data / Worst case" toggle and report everything that broke, with the fix for each. Use when the user asks to stress-test, break, or find edge cases in a component or screen, or to "try the worst case". For visual design critique use emil-design-eng; for motion use review-animations.

LIKELION-CAPSULE/Landing_Page

Builds UI from a Figma file or a design image so it matches the design, using your project's existing tokens and components.

LIKELION-CAPSULE/Landing_Page

Explains how a website, a visual effect or an animation was built, from a live URL or a screenshot.

LIKELION-CAPSULE/Landing_Page

Reviews a branch, pull request or uncommitted change for the interface problems it introduced or regressed, across accessibility, layout, writing, typography, color and UI.

LIKELION-CAPSULE/Landing_Page

Make a web app feel native on a phone — the small CSS and meta-tag fixes that separate "a website in a browser" from something that feels installed. Covers sticky hover states, tap highlight flashes, the 100vh bug, inputs that zoom the page, laggy taps, pull-to-refresh hijacking scroll, content under the notch, long-press selecting button text, carousels that scroll the wrong way, mismatched status bars, and the rule that you test on real hardware. Use when a web app is being built for or reviewed on mobile, when something "works in Chrome but feels wrong on my phone", when building a PWA, a bottom sheet, a carousel, a full-screen layout, or any touch interaction. For motion itself use animate; for React Native use animate-expo.

LIKELION-CAPSULE/Landing_Page

Renders every state of a component you choose on a throwaway page, with mock data and a switcher, so you can work on each state.

LIKELION-CAPSULE/Landing_Page

Builds multiple variants of a component you're working on and helps you iterate and pick one.

相關技能