VOOZH about

URL: https://thenewstack.io/a-hotter-pink-css-devs-get-an-explosion-of-new-colors/

⇱ A Hotter Pink: CSS Gets an 'Explosion' of New Colors - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2022-05-28 05:00:38
A Hotter Pink: CSS Gets an 'Explosion' of New Colors
news,
Software Development

A Hotter Pink: CSS Gets an ‘Explosion’ of New Colors

"Color is exploding with features in 2022. We have new color spaces, more colors, built-in color manipulation, and auto contrast function noted Adam Argyle, Google's Chrome CSS Developer advocate, in a "State of CSS" video talk prepared for Google I/O earlier this month.
May 28th, 2022 5:00am by Joab Jackson
👁 Featued image for: A Hotter Pink: CSS Gets an ‘Explosion’ of New Colors

Just as television dramatically moved from black-and-white to color pictures in the 1950s and 1960s, so too are Cascading Style Sheets (CSS) going through a similar revolution. Everyone’s favorite stylesheet language is getting a range of new features that will allow developers and designers work with a far wider, and more nuanced, set of colors.

“Color is exploding with features in 2022. We have new color spaces, more colors, built-in color manipulation, and auto contrast functions,” noted Adam Argyle, Google’s Chrome CSS Developer advocate, in a “State of CSS” video talk prepared for Google I/O earlier this month.

Many of these features are currently only supported by the development releases of most browsers. But over time, they should be available across the board.

More Color Spaces

Perhaps most importantly, the new CSS color options are no longer dependent on the standard sRGB (standard red, green, and blue) spectrum, a color space designed by Microsoft and HP for PCs that developers relied on for the past 25 years to choose colors. Now 10 new color spaces are supported, all with a wider range of colors.

For instance, one color space, display-p3 offers 50% percent more colors, almost all of them already supported by modern laptops, TVs and smartphones.

The idea is that developers can now use more vivid colors, the kind that are already supported in Adobe Photoshop, for instance. These colors, however, will be rendered by the browser itself, directly on the page.

“You thought you were picking hot pink in your color picker. But if you change the color space you’re picking from,” you can get a much more vivid pink for your design, Argyle notes.

Different color spaces divide up their respective spectrums in different ways, offering new gradients that can be easier to work with. based on math, sRGB has a lot of “dead zones” of uninteresting, muddy colors, whereas lch() and Lab() offer fuller gradients, consisting of all the colors humans can see. Currently, the Safari browser supports both of these. Here is the syntax for the “hot pink” color in lch:

#lch {
rad-pink: lch(50% 200 230);
}

In lch, the first number, the “CIE Lightness” represents the lightness of the color (l), from black at 0 to white at 100. The second value, the chroma (c), is the amount of color, and the third value, is the hue (h). The CIE lightness here is 50% based on a perceptual, rather than mathematical, color space, with no muddy dead zones.

The CSS Media query provides a way to query the browser to see if HD colors are accepted and the CSS Support query checks to see if the browser supports the color space.

Although way to generate colors is through the adjustment of hues.

HWB() can compose a color based on its balance of hue, whiteness and blackness. “It’s an internationally humanistic way of thinking about color,” Argyle said. In the demo below, Argyle showed five swatches with the same hue, but with varying ratios of white and black.

👁 CSS HWB example

Five swatches with the same Hue setting, but differing portions of black and white.

Auto-Generated Colors

You can also mix colors of the fly, with the new color-mix(). This bit of functional notation mixes two colors in a color space of your choice (by default in lch). You can also specify by percentage how dominant the color is in the mix. The color-contrast() element actually has the browser pick appropriate colors for a web page, based on the pre-selected thematic hues. It can even mix them to an AA contrast ratio needed to meet accessibility standards. The idea is that will “automate good contrast,” for accessibility and branding.

The Relative-Color syntax is another way the browser can help with branding and accessibility efforts. It can extract new colors from existing colors, Argyle said. This is also great for consistent branding, where all the colors must coordinate with the brand colors, Argyle pointed out. “It gives me the power to create perceptually linear palettes with very, very little code,” Argyle noted.

CSS will also be offering many new gradients, or the rules of how colors blend into one another. Today, gradient manipulation is only available for sRGB, though a set of new controls for picking gradients for other color spaces will soon be available. Different color spaces will display different interim colors moving across the gradient.

👁 Image

A background color, in the HSL color space, that fades from black to white, would be rendered like this:

background-image: linear-gradient(
 to right in HSL,
 black, white
);

Fonts themselves also get some more color. The new Colrv1 fonts — supported by all browsers except Firefox — allows the developer to add gradients, compositing and blending to font definitions. “This could be a huge win for icon fonts,” Argyle said.

Color changes can also be made to checkboxes and other elements of a webpage. The accent-color property allows you to tint built-in elements, which can be used to thematically cohere a webpage with a lot more nuance. “Bring your brand color to your forms with one line of CSS, and the browser will ensure that there’s proper contrast between your color and the checkboxes and the tracks,” Argyle said. Accent colors can be applied to an entire website, or to just selected elements. It can also be used to adjust a webpage to the user’s preference of light or dark modes.

For a full rundown, check the whole presentation here:

TRENDING STORIES
Joab Jackson is a senior editor for The New Stack, covering cloud native computing and system operations. He has reported on IT infrastructure and development for over 30 years, including stints at IDG and Government Computer News. Before that, he...
Read more from Joab Jackson
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.