惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
PCI Perspectives
PCI Perspectives
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Google Online Security Blog
Google Online Security Blog
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
The GitHub Blog
The GitHub Blog
S
Secure Thoughts
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
WordPress大学
WordPress大学
SecWiki News
SecWiki News
B
Blog
小众软件
小众软件
Hacker News - Newest:
Hacker News - Newest: "LLM"
Webroot Blog
Webroot Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
L
LINUX DO - 热门话题
Recent Commits to openclaw:main
Recent Commits to openclaw:main
酷 壳 – CoolShell
酷 壳 – CoolShell
IT之家
IT之家
The Cloudflare Blog
Google DeepMind News
Google DeepMind News
Know Your Adversary
Know Your Adversary
Y
Y Combinator Blog
F
Fortinet All Blogs
W
WeLiveSecurity
博客园 - Franky
MongoDB | Blog
MongoDB | Blog
Last Week in AI
Last Week in AI
The Last Watchdog
The Last Watchdog
S
Schneier on Security
爱范儿
爱范儿
V
V2EX - 技术
L
LINUX DO - 最新话题
月光博客
月光博客
博客园 - 【当耐特】
Latest news
Latest news
阮一峰的网络日志
阮一峰的网络日志
博客园 - 司徒正美
U
Unit 42
Schneier on Security
Schneier on Security
E
Exploit-DB.com RSS Feed
J
Java Code Geeks
Cyberwarzone
Cyberwarzone
T
The Blog of Author Tim Ferriss
TaoSecurity Blog
TaoSecurity Blog
博客园 - 叶小钗
T
Troy Hunt's Blog
大猫的无限游戏
大猫的无限游戏
AI
AI
Security Latest
Security Latest

Matthias Ott

Hello Again, World This, Still Not for Everyone The Shape of Friction WeissKlang L1 – Punching Above Its Weight Continvoucly Morged Value Webspace Invaders To Affinity and Beyond The Mystery of Storytelling Amateurs! Echoes of Connection Linear() Is Not (That) Linear View Transitions: The Smooth Parts Adding AVIF and WebP Support to My Craft CMS Site Challenge Acoustic Room Treatment and Building Sound Panels, Part 1: Planning Play On Overshoot The HTML Output Element Listening Closely Compressed Fluid Typography The Lifeblood of the Web What Could Go Wrong? That’s My Rank Making Space CSS :is() :where() the Magic Happens Visual Regression Testing for External URLs With Playwright Jane Goodall’s Famous Last Words European Tech Alternatives 🇪🇺 Independent Type Foundry Advent Calendar – Day 24: NaN Independent Type Foundry Advent Calendar – Day 23: Typotheque Independent Type Foundry Advent Calendar – Day 22: 205TF Independent Type Foundry Advent Calendar – Day 21: HvD Fonts Independent Type Foundry Advent Calendar – Day 20: Frere-Jones Type Independent Type Foundry Advent Calendar – Day 19: Fontwerk Independent Type Foundry Advent Calendar – Day 18: Vectro Independent Type Foundry Advent Calendar – Day 17: Studio René Bieder Independent Type Foundry Advent Calendar – Day 16: R-Typography Independent Type Foundry Advent Calendar – Day 15: David Jonathan Ross Independent Type Foundry Advent Calendar – Day 14: Interval Type Independent Type Foundry Advent Calendar – Day 13: Newglyph Independent Type Foundry Advent Calendar – Day 12: Swiss Typefaces Independent Type Foundry Advent Calendar – Day 11: Sharp Type Independent Type Foundry Advent Calendar – Day 10: Colophon Foundry Independent Type Foundry Advent Calendar – Day 9: Commercial Type Independent Type Foundry Advent Calendar – Day 8: Letters from Sweden Independent Type Foundry Advent Calendar – Day 7: Lineto Independent Type Foundry Advent Calendar – Day 6: Ohno Type Company Independent Type Foundry Advent Calendar – Day 5: Milieu Grotesque Independent Type Foundry Advent Calendar – Day 4: TypeMates Independent Type Foundry Advent Calendar – Day 3: Klim Type Foundry Independent Type Foundry Advent Calendar – Day 2: Dinamo Independent Type Foundry Advent Calendar – Day 1: Grilli Type The Independent Type Foundry Advent Calendar 2022 A Conversation With ChatGPT ChatGPT, please explain websites in the words of William Shakespeare Transient Frameworks Leaving Twitter Behind Converting Your Twitter Archive to Markdown The Wrong Question It Wasn’t Written Syndicating Posts from Your Personal Website to Twitter and Mastodon Suspension None of Your Business Doing Our Part Patch That Package Brain Dump Generating Accessibility Test Results for a Whole Website With Evaluatory The CSS Cascade, a Deep Dive Updates About Updates How to Delete Your Commit History in Git Unblocking Your Writing Blocks, Part 2: I’m Not an Expert nor a “Thought Leader” Connections No Wrong Notes Better Options Design Debt Finite and Infinite Games Don’t Assume, Validate. Necessity Is the Ultimate Teacher One Egg Go Deep There Is No Secret Code Balancing Risk Blue Eyes, Brown Eyes The Shortcut Boomerang My RSS Feed Collection of Personal Websites Frequency The Illusion of Control The Decisions Journey Write It Down Nownownow Into the Personal-Website-Verse Considering the Opposite What is it for? Unlimited Bowling. Never done. We Are Team Internet. We Need to Save #NetNeutrality. Progressive Search Data loss (also) by JavaScript Books I Will Definitely Maybe Read in 2017 Starting to Write Notes
World Wide Gamut Web
Matthias Ott · 2020-06-03 · via Matthias Ott

Color on the Web has seen many iterations. When I started to fall in love with the Web in the late nineties, every self-respecting web designer was using web-safe colors. Although it can be argued that they never really worked, because colors still looked different on different screens, web-safe colors were at least the attempt to achieve consistency in a time where it was worth mentioning in ads that a monitor was able to display “millions of colors“.

Today, we are using not only the hex notation and rgb() in CSS but also rgba() to control transparency. Our displays have grown to be much more accurate in how they display color. And in recent years, so-called wide gamut displays have become increasingly popular. While the old lowest common denominator was the tiny sRGB color space, many modern displays are able to reproduce a much larger color gamut, resulting in more vivid, vibrant colors. Once primarily used in prepress workflows to reproduce the full range of printable colors, wide gamut displays can now be found in both pro and consumer monitors, laptops, and even tablets and smartphones. The DCI-P3 color space, originally designed as a standard for digital movie projection for the film industry, made its debut in a consumer computer in September 2015 in Apple’s iMac. A year later, both Apple and Samsung released their first flagship phones with P3 wide gamut display.

Now, support for these wider color spaces is finally coming to the Web. In case you want to dig deeper, Lea Verou has written a brilliant article on the upcoming changes. The CSS 4 Color specification includes, among other things, lab() and lch(). LCH is a color space designed to cover the entire spectrum of human vision, so it is even larger than P3. Safari already supports it, Chrome is going to support it soon, and Firefox is considering implementation. With the lch() color function and support for the P3 color space in our devices, we will therefore soon have access to about 50% more colors than with sRGB. Another advantage is that LCH, which stands for “Lightness, Chroma, Hue”, is perceptually uniform. So when you define two colors that share the same lightness, the two colors will indeed be perceived as being equally bright by the human eye, which can also be useful if you want to create an accessible color palette.

Here is how you write a color with the new lch() function, in the new commaless syntax:

/* CSS / Sass */
lch(50% 73 327)

The first value stands for the lightness of the color and is written as a percentage ranging from 0 to 100. The second value, chroma, is a number that describes how vibrant and saturated the color is. It starts at 0 but is theoretically unbound, so how high it can be set depends on the color gamut of the monitor. Usually, it doesn’t exceed 230, though. The third value ranging from 0 to 360.

If you want to also use an optional alpha channel, you can do so with the new notation that uses a slash:

/* CSS / Sass */
lch(50% 73 327 / 75%)

Lea Verou also made a neat LCH Color Picker. Have a look at it and play around with the values a bit. For best results, use Safari on a machine with a wide gamut display.

Screenshot of LCH Color Picker

CSS 4 Color also adds a new color() function, which can be used to specify a color in a certain color space, like P3, for example:

/* CSS / Sass */
color(display-p3 1 0 0.331)

Here, the color function is used to first define the color space and then set the color with three values ranging from 0 to 1 which represent the red, green, and blue channels. Ollie Williams nicely explains the new color() function as well as LCH in his post over at CSS-Tricks.

As you can see, a lot is going on at the moment in terms of how we can write colors in CSS. And while a few of those features might not yet be ready for prime time in all browsers, we can already make use of them in supporting browsers using progressive enhancement. We can, for example, use the new color-gamut media query to write specific CSS only for devices that support a certain color space.

/* CSS / Sass */
@media (color-gamut: p3) {
  .main {
    background-color: color(display-p3 1 0 0.331);
  }
}

Another option would be to check for support using @supports:

/* CSS / Sass */
/* sRGB color. */
:root {
    --bright-green: rgb(0, 255, 0);
}

/* Display-P3 color, when supported. */
@supports (color: color(display-p3 1 1 1)) {
    :root {
        --bright-green: color(display-p3 0 1 0);
    }
}

header {
    color: var(--bright-green);
}

So while Safari is currently the only browser with full support for lch() and color() there really is no need to wait until the other vendors have added support. I for one will look into how I can update the colors of my site a bit over the next days to make my site ready for this next, exciting era of color on the World Wide (Gamut) Web.

-

This is the seventh post of my 100 days of writing series. You can find a list of all posts here.

~

2 Webmentions

1 Like

ⓘ Webmentions are a way to notify other websites when you link to them, and to receive notifications when others link to you. Learn more about Webmentions.