Communitygithub.com

LIKELION-CAPSULE/Landing_Page

帮助您为项目构建和检查色彩系统。它能生成调色板、命名语义令牌、在格式之间进行转换并测量对比度。

Landing_Page 是什么?

该技能旨在协助开发者和设计者系统化地构建、审计和维护色彩系统。它支持从零开始创建调色板(推荐使用 OKLCH 色彩空间),并自动将生成的色阶映射到语义化的令牌名称,确保颜色在不同组件中按角色使用,而非直接引用原始色值。技能涵盖色彩格式转换(如 hex、OKLCH、HSL)、对比度测量(基于实际渲染背景)以及无障碍性检查,并能识别角色映射断裂、对比度失败、色域外等具体问题。它适配流行的设计系统约定(如 Tailwind 的 50–950 或 Radix 的 1–12),并强调色彩不应是传达信息的唯一手段。最终以结构化的报告形式输出发现项,按严重性分级,并给出“通过”或“阻塞”的最终评估。

兼容平台~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。

匹配项目的色彩系统

复用项目已有的令牌和记法。一个一致的十六进制系统胜过混杂了十六进制和 oklch() 的系统。

对于新系统,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)。

完成之前

模式修复方法
组件文件中存在已定义令牌的十六进制、rgb( 或 oklch( 字面量复用或添加角色令牌,并使用项目的记法
代码库中一个 oklch( 值混在其他均用十六进制书写的代码中除非范围包含迁移,否则使用既定记法
组件文件中出现 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 类下设置了颜色令牌选择一种切换机制并始终使用它
改变色相而不改变明度的对比度修复改变明度——这是对比度响应所在的通道
prefers-contrast: more 在一个代码块中覆盖了两种外观的颜色为每种外观分别提供其增强对比度的值
在带有 alpha 值的颜色上放置文本,例如 /50、rgba( 或与 transparent 混用的 color-mix(测量渲染后的结果,或使用不透明令牌
在 Tailwind 500 填充上使用 text-white测量它;白色在大多数 500 色相上无法达到 4.5:1,因此将填充移至 600
oklch() 的色度超出了 sRGB 范围,且之前未声明 sRGB 值先声明 sRGB 值,然后在 @media (color-gamut: p3) 内声明鲜艳值

报告

严重性。 HIGH 指内容无法阅读或分配了误导性的语义颜色。MEDIUM 指明显的主题、令牌或色域故障。LOW 指孤立的打磨问题。

以下三种症状无论出现在何处,一经发现即视为 HIGH,并匹配 better-interface 的升级触发条件:正文或控件文本的渲染对比度对未达到所需比率;仅通过颜色传达状态或含义;语义颜色被用于与其含义相悖之处。

验证。 无浏览器时:检查令牌值、每种声明颜色的色域、两个主题块是否都存在,以及从声明的令牌对计算的对比度。有浏览器时:测量文本背后实际渲染的背景,包括透明度及其下方的任何图像,并在浅色和深色模式下分别测量。报告所有无法执行的检查为 未验证。

格式。 将发现项按其违反的原则分组,按严重性排序,每个根因一行,列出其出现的所有位置:

严重性位置之前之后原因

位置 为 路径/到/文件:行号。原因 指出违反的原则及对用户的影响。

以 阻塞 结尾(当存在任何 HIGH 问题时),否则以 通过 结尾,并将剩余项保留在表格中作为待办工作。切勿对未经检查的覆盖范围给出 通过。如果无任何可报告项,则声明“未发现可操作的色彩问题”并报告验证状态。

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.

相关技能