CSS color‑mix() Function Playground - Online Tester
Dynamically blend two colors using the CSS color‑mix() function in different color spaces. Copy the exact CSS snippet. No JS required.
UD5 Toolkit
HEX — 最常用的颜色格式,使用6位十六进制表示RGB。简洁通用,所有浏览器完美支持。
rgb() / rgba() — 红绿蓝通道,每通道0-255。现代CSS统一使用 rgb(r g b / a) 语法。
hsl() / hsla() — 色相(Hue)、饱和度(Saturation)、亮度(Lightness)。HSL 更贴近人类感知,调整颜色更直观。
hwb() — 色相(Hue) + 白度(Whiteness) + 黑度(Blackness)。比HSL更直观地混合白色或黑色来调整颜色。
oklch() ⭐ — 现代CSS颜色空间,感知均匀。L(亮度0-1)、C(色度)、H(色相)。可表达P3广色域颜色,比sRGB鲜艳50%。MDN
oklab() — 改进的Lab空间,感知均匀,计算效率高。L(亮度0-1)、a(绿-红轴)、b(蓝-黄轴)。适合渐变插值。
lch() — CIELCh颜色空间。L(亮度0-100)、C(色度)、H(色相)。比HSL更均匀,可表达超出sRGB的颜色。
lab() — CIE Lab颜色空间。L(亮度0-100)、a(绿-红)、b(蓝-黄)。设备无关,覆盖人类可见所有颜色。
OKLCH is perceptually uniform — equal numeric changes produce equal visual changes. HSL has uneven brightness perception (e.g., yellow at 100% lightness looks much brighter than blue at 100%). OKLCH also unlocks the P3 wide gamut for 50% more vibrant colors on modern screens.
Modern CSS uses space-separated values: rgb(255 128 0 / 0.8) instead of rgba(255,128,0,0.8). Both work, but the new syntax is cleaner and allows omitting alpha when not needed.
OKLCH is supported in Chrome 111+, Safari 15.4+, Firefox 113+, and Edge 111+. Global coverage is ~92% as of 2025. Use @supports (color: oklch(0 0 0)) for graceful fallbacks.
Display P3 covers ~50% more colors than sRGB. Colors defined with oklch() or color(display-p3 ...) can utilize these extra-vibrant colors on compatible displays (most modern phones and Macs).
Define: --brand: oklch(0.65 0.25 260); — then use color: var(--brand); anywhere. You can even animate between color spaces with @property for smooth transitions.
OKLab is a simplified, computationally efficient version of CIE Lab, designed for better performance in real-time applications. Both are perceptually uniform, but OKLab is preferred for web use due to simpler math and better gradient interpolation.
Dynamically blend two colors using the CSS color‑mix() function in different color spaces. Copy the exact CSS snippet. No JS required.
Grid of all 148 named CSS colors. Hover to see detail, click to copy the name or hex. Essential frontend reference.
Use the light‑dark() CSS function to change colors based on color scheme. Build a simple dark mode toggle with one property.
Test the upcoming contrast‑color() CSS function. Get white or black automatically for a given background. See it live.
A complete, searchable list of all 140+ named HTML/CSS colors with their hex codes and color previews. Click to copy code. Essential web reference.
Type a CSS color name like 'tomato' or 'mediumseagreen' and instantly get its hex code and preview. Complete named colors list.
Pick a color in the Display‑P3 space and get the CSS color() function. See the difference from sRGB. For modern design.
Paste a stylesheet and extract every unique color (hex, rgb, hsl) into a palette. Swatches displayed. Copy as JSON.
Paste hex colors, generate a contrast matrix against each other. Identify failing pairs for WCAG.
Enter color in any CSS format and see all other representations. Live preview. Swatch history.
Enter a color palette and see how it looks for different types of color vision deficiency. Get warnings on conflicting colors.
Set a custom accent color for checkboxes, radios, range, and progress. See the browser’s rendering. Copy the CSS.
Paste a list of hex colors and generate CSS custom properties for them. Create your design token file instantly.
Fetch a website's CSS and extract :root custom properties (‑‑color) to reveal its design token palette. For learning and inspiration.
Enter a CSS selector and see its specificity broken down into A,B,C columns with a visual weight comparison. Learn specificity.
See the Pantone Colors of the Year and popular palettes from past years. Get hex codes. Design inspiration.
Generate a range of tints and shades from a single hex color. Ideal for data visualization, UI design systems, and Tailwind custom palette creation. Local tool.
Paste body text and test different font/background combos. See an actual passage rendered, not just a ratio. True feel for legibility.
Interactively create colors in HWB space and get the CSS hwb() function. Simplifies tint/shade workflows. Live preview.
Mix and save colors using a color picker. Drag to reorder. Export as CSS variables or hex list.
Discover beautiful color palettes for your projects. Generate random, complementary, or trendy schemes and copy hex codes. Useful for designers and developers.
Build a palette and simulate how it appears to various color deficiencies. Also generate pre-vetted accessible palettes. Local processing.
Find the official name of any hex color from the extended color dictionary. Search by name to get the hex code. Handy for CSS and design language.
Style the <progress> and <meter> elements with cross‑browser CSS. Adjust colors and sizes. Copy the final styles.
Use <input type='color'> and see its change events and value in hex. Understand the native color picker. Quick demo.
Pick a base color and generate a full palette of 10 shades (50 to 900) like Tailwind CSS. Copy as hex or hsl.
Convert RGB and RGBA color values to their HEX or HEX+alpha representation. Live preview and copy CSS color strings instantly.
Enter a palette of colors and see a grid showing whether each foreground/background pair passes AA or AAA contrast. Must for designers.
Pick a source color and generate a complete M3 tonal palette with light/dark schemes. Export as CSS custom properties.
Select emotions (calm, energetic, sad) and generate a harmonious color palette that reflects the mood.