CSS Color Function Explorer - Online Write Modern Colors
Write modern CSS color functions like oklch(), lab(), hwb() and see the rendered color with fallback. Copy compatible code.
UD5 Toolkit
Visually explore the CSS color-mix() function across different color spaces in real time.
Use this directly in your CSS for color, background-color, border-color, etc.
background-color: color-mix(in srgb, #6366f1 50%, #f59e0b 50%);
The color-mix() CSS function takes two colors and returns the result of mixing them in a specified color space, with an optional percentage for each color. It's part of the CSS Color Module Level 5 specification and allows developers to dynamically blend colors directly in CSS without preprocessors like Sass or LESS.
As of 2024, color-mix() is supported in Chrome 111+, Firefox 113+, Safari 16.2+, and Edge 111+. It has broad modern browser support (over 90% global coverage). For older browsers, consider providing fallback colors using @supports queries.
sRGB is the standard color space for the web but it's not perceptually uniform — equal numerical steps don't produce equal visual changes. OKLab is designed to be perceptually uniform, meaning gradients and mixes look more natural and smooth to the human eye. For color mixing that looks visually balanced, OKLab or OKLCh are often better choices than sRGB. Try switching between them on the gradient strip above to see the difference!
Each color in color-mix() can have an optional percentage. If both percentages are specified and sum to 100%, that's the exact ratio. If only one is specified, the other automatically becomes 100% - specified%. If neither is specified, it defaults to 50%–50%. If percentages sum to less or more than 100%, they are scaled proportionally. Example: color-mix(in srgb, red 30%, blue) → blue gets 70% automatically.
Absolutely! This is one of the most powerful use cases. You can define colors as CSS custom properties and mix them dynamically: --primary: #6366f1; --accent: #f59e0b; background: color-mix(in oklab, var(--primary) 70%, var(--accent) 30%); This enables theme systems with dynamic color blending that were previously only possible with preprocessors.
Common use cases include: creating dynamic hover/active states by mixing with white or black; generating accessible color palettes from a base color; creating semi-transparent overlays without opacity; building theme systems with CSS custom properties; generating gradient midpoints; and creating color variations for charts and data visualizations — all directly in CSS without JavaScript or preprocessors.
Write modern CSS color functions like oklch(), lab(), hwb() and see the rendered color with fallback. Copy compatible code.
Use the light‑dark() CSS function to change colors based on color scheme. Build a simple dark mode toggle with one property.
Pick a color in the Display‑P3 space and get the CSS color() function. See the difference from sRGB. For modern design.
Paste a list of hex colors and generate CSS custom properties for them. Create your design token file instantly.
Interactively create colors in HWB space and get the CSS hwb() function. Simplifies tint/shade workflows. Live preview.
Test the upcoming contrast‑color() CSS function. Get white or black automatically for a given background. See it live.
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.
Discover beautiful color palettes for your projects. Generate random, complementary, or trendy schemes and copy hex codes. Useful for designers and developers.
Grid of all 148 named CSS colors. Hover to see detail, click to copy the name or hex. Essential frontend reference.
Set a custom accent color for checkboxes, radios, range, and progress. See the browser’s rendering. Copy the CSS.
Style the <progress> and <meter> elements with cross‑browser CSS. Adjust colors and sizes. Copy the final styles.
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.
Type a CSS color name like 'tomato' or 'mediumseagreen' and instantly get its hex code and preview. Complete named colors list.
Paste a stylesheet and extract every unique color (hex, rgb, hsl) into a palette. Swatches displayed. Copy as JSON.
Enter color in any CSS format and see all other representations. Live preview. Swatch history.
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.
Experiment with CSS container queries. Resize a container and see the styles change according to its size, not the viewport. Learn the new spec.
Enter a color palette and see how it looks for different types of color vision deficiency. Get warnings on conflicting colors.
Pick a source color and generate a complete M3 tonal palette with light/dark schemes. Export as CSS custom properties.
Generate single random colors or full palettes. Displays hex, RGB, and copy on click. Great for design inspiration.
Pick a base color and generate a full palette of 10 shades (50 to 900) like Tailwind CSS. Copy as hex or hsl.
Style an `<input type='range'>` with custom track and thumb. Cross‑browser CSS. Preview and copy the code.
Design a light and dark theme by picking colors for backgrounds, text, and links. Get the CSS for both themes. Local.
Convert RGB and RGBA color values to their HEX or HEX+alpha representation. Live preview and copy CSS color strings instantly.
Paste body text and test different font/background combos. See an actual passage rendered, not just a ratio. True feel for legibility.
Build a palette and simulate how it appears to various color deficiencies. Also generate pre-vetted accessible palettes. Local processing.
Enter a palette of colors and see a grid showing whether each foreground/background pair passes AA or AAA contrast. Must for designers.
Pick colors using the HWB (Hue‑Whiteness‑Blackness) model. Get the CSS hwb() function code. Simpler than HSL for some.
Mix and save colors using a color picker. Drag to reorder. Export as CSS variables or hex list.