Chuyển đến nội dung
Skillpedia
Giao diện (UI/UX)75k · #2776

color-oklch

Skill này làm gì

Skill này giải thích cách định nghĩa màu trong không gian màu oklch, phù hợp với cách con người cảm nhận độ sáng. Skill dành cho nhà thiết kế và lập trình viên xây design system hoặc bảng màu dễ tiếp cận.

Khi nào nên dùng

  • ✓Khi bạn xây một bộ màu thương hiệu có các sắc độ sáng và tối.
  • ✓Khi trạng thái hover và nhấn của các màu khác nhau trông không đều.
  • ✓Khi bạn muốn bảng màu chế độ tối giữ nguyên độ sáng cảm nhận.

Liên kết skill

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/color-oklch/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/color-oklch/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Hãy xây một bảng màu xanh dương bằng oklch với mười sắc độ cách đều nhau cho design system của tôi.”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Agent chuyển các token màu sang oklch, giữ giá trị độ sáng nhất quán giữa các màu cho từng bước sắc độ, và có thể cung cấp màu gam rộng cho màn hình hỗ trợ.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

Use oklch() and oklab() for perceptually uniform colour palettes

HSL and hex colours are defined in the sRGB colour space, which is not perceptually uniform — a 10 % lightness change looks dramatically different depending on the hue. This makes creating accessible, harmonious palettes by hand extremely difficult. oklch corrects this: adjusting the L channel produces the same perceived brightness change regardless of hue or chroma, making it far easier to build accessible colour ramps, dark-mode palettes, and consistent hover/active states.

Quick Reference

  • oklch(L C H) — Lightness, Chroma, Hue — is the most practical perceptually uniform colour space for design systems
  • Equal lightness steps in oklch look equal to the human eye; equal steps in hsl do not
  • Define your colour palette tokens in oklch custom properties
  • Use @media (color-gamut: p3) to serve wide-gamut colours to capable displays

Check

Check whether the CSS colour tokens use oklch() or a perceptually uniform colour space, or whether they use hsl/hex which may produce inconsistent perceived lightness across hues.

Fix

Convert the colour token palette from hsl/hex to oklch, ensuring the lightness (L) axis is consistent across all hues in the same shade step.

Explain

Explain what perceptual uniformity means in colour spaces, why oklch is better than hsl for design systems, and how the L, C, H channels map to human colour perception.

Code Review

Review CSS custom properties for colour tokens. Flag palette definitions in hsl or hex that use hardcoded values without a systematic lightness ramp, especially if they are intended to be interchangeable shade steps.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/css/color-oklch

Câu hỏi thường gặp

Vì sao hsl chưa đủ?

Skill nói hsl không đều về mặt cảm nhận, nên thay đổi 10 phần trăm độ sáng có thể trông rất khác nhau giữa các màu.

L, C và H nghĩa là gì?

Độ sáng, độ bão hòa và sắc thái, ba thành phần tạo nên một màu oklch.

Có thể cung cấp màu rộng hơn cho một số màn hình không?

Có. Skill nhắc tới media query color-gamut để phục vụ màu gam rộng cho màn hình hỗ trợ.

Chi tiết

Mô tả gốc của tác giả

Use when building a design token system, creating accessible colour palettes, generating colour ramps programmatically, or migrating a design system to support wide-gamut displays.

repo: thedaviddias/Front-End-Checklist

Độ phổ biến

Sao GitHub
75k
Vị trí xếp hạng
#2776
Giấy phép
MIT
Cập nhật
31/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự