The web is being reworked to display a rainbow of previously unavailable colors, but part of the transition demands abandoning commas for spaces when coding CSS color-space parameters.
Word of the new cruelty went out via Twitter on Thursday when Mathias Bynens, who works on Google's Chrome team, advised web developers to adopt "the modern comma-free CSS color syntax."
The reason, he explained, is that modern CSS color display functions, specifically lab(), lch(), and color(), don't work with commas. These functions provide different ways to express color values.
CSS, short for Cascading Style Sheets, is a domain-specific declarative programming language for laying out web pages, usually in conjunction with HTML and JavaScript. It has used commas since its first appearance in the mid-1990s, and it continues to do so.
But CSS is evolving, and since 2016 there's been an effort spearheaded by Tab Atkins Jr, a developer on the Google Chrome team, and Elika Etamad (@fantasai), a member of W3C CSS Working Group and a Mozilla contributor, to get rid of unnecessary commas in CSS code related to color.
The rationale for doing so is consistency, though not everyone endorses the idea. Commas have a specific role in CSS.
"In CSS, functions are a just a way to group/name a syntax chunk, so they should work by the same rules that CSS grammar does in general: values are optional and re-orderable when possible, space-separated, and commas are used to separate *repetitions* only," Atkins wrote in a Twitter post.
The syntax for rgb() and rgba() violates this rule, he said. And in the color() function, there are different color spaces that can take a different number of values, making it difficult to know whether the final number refers to color or alpha (opacity).
Support for the comma-less syntax made its way into CSS Color Module Level 4, which became an official part of the CSS specification last year, and it's now being baked into various web browsers.
"Some parts of it have been implemented earlier than others: the comma-less syntaxes are widely supported now, limited forms of the color() function are supported in [WebKit], and the more advanced color functions (lab(), lch(), the rest of color() + @color-profile) will be coming to all browsers as they continue to improve their handling of wider and deeper color gamuts," explained Atkins via Twitter DM.
The color gamut refers to the range of available colors in a particular color space. One such color space is sRGB, used on the web to define colors in terms of red, green, and blue values ranging from 0 to 255.
There are other color spaces like Display-P3 that define a wider range of colors, about a third more than sRGB. Modern monitors can display these colors but web developers can't specify them in CSS using the traditional comma-separated syntax.
In a post earlier this month, Lea Verou, a doctoral student in computer science at MIT and member of the W3C CSS Working Group, described the situation thus:
"CSS right now cannot access these colors at all. Let me repeat: We have no access to one third of the colors in most modern monitors. And these are not just any colors, but the most vivid colors the screen can display. Our websites are washed out because monitor hardware evolved faster than CSS specs and browser implementations."
The CSS functions for displaying these more vivid colors are making their way from specification to browser. Apple's WebKit browser engine introduced support for Display-P3 in 2016, and was still the only browser engine to support it as of January 2020. But Safari, Chrome, and Firefox are working on their respective implementations.
Once the capability to display wide gamut color spaces arrives in browsers, space-separated, comma-less CSS will be required. Hence, the call to drop commas in CSS color code.
Sponsored: Practical tips for Office 365 tenant-to-tenant migration
See the article here:
- Hang onto your hats--More Redheads RFL Shopping 🙂 - November 8th, 2009 [November 8th, 2009]
- Why I Relay -- from Daaneth Kivioq - November 8th, 2009 [November 8th, 2009]
- Two Upcoming Events! - November 8th, 2009 [November 8th, 2009]
- We had fun AND ... - November 8th, 2009 [November 8th, 2009]
- Why I Relay -- from Edith Halderman & Envy Watts - November 8th, 2009 [November 8th, 2009]
- Toga! Toga! We had fun and raised 5k for RFL! - November 8th, 2009 [November 8th, 2009]
- "Duel of the DJ's" --THIS Sunday, April 19 at 1pm - November 8th, 2009 [November 8th, 2009]
- Dressing for Relay Events... Lag in Style! - November 8th, 2009 [November 8th, 2009]
- "Duel of the DJ's" -- TODAY Sun, April 19 at 1pm - November 8th, 2009 [November 8th, 2009]
- Relay Shopping Made Easy! Our Very Own Store! - November 8th, 2009 [November 8th, 2009]
- We have a winner! - November 8th, 2009 [November 8th, 2009]
- Not to Miss! Frogg & Jaycatt Saturday at 1pm SLT - November 8th, 2009 [November 8th, 2009]
- Thank You Frogg, Jaycatt, Lomgren and Luskwood! GO RELAY! - November 8th, 2009 [November 8th, 2009]
- Upcoming Events in Redhead-land - November 8th, 2009 [November 8th, 2009]
- In Memory of ... Lachlan Campbell - November 8th, 2009 [November 8th, 2009]
- More Goodies in Our RFL Store - November 8th, 2009 [November 8th, 2009]
- The BIG Blowout Event! 12-3pm SLT Tomorrow! - November 8th, 2009 [November 8th, 2009]
- ONE WORLD, ONE HOPE! - November 8th, 2009 [November 8th, 2009]
- We miss you Fimi! - November 8th, 2009 [November 8th, 2009]
- Redheads Know How To Partay!!! - November 8th, 2009 [November 8th, 2009]
- We had a BALL! And the SILENT AUCTION continues... - November 8th, 2009 [November 8th, 2009]
- RenFaire! - November 8th, 2009 [November 8th, 2009]
- Rocking With Yahshvah Shinja - November 8th, 2009 [November 8th, 2009]
- WOW! - November 8th, 2009 [November 8th, 2009]
- What a weekend that was! - November 8th, 2009 [November 8th, 2009]
- 2010 Blog! - April 4th, 2010 [April 4th, 2010]
- Brian Scalabrine - The World's Greatest - Video - March 29th, 2012 [March 29th, 2012]
- Red strength hint in caution notice - April 25th, 2012 [April 25th, 2012]
- Emma Roberts turns heads at Coachella - April 25th, 2012 [April 25th, 2012]
- Cartoon of the Day: Chelsea's battered bus leaves Terry behind and heads for Munich after rolling over Barcelona - April 25th, 2012 [April 25th, 2012]
- Kaskade Heads Out On 'Freaks Of Nature' Tour, Gives Us Full-Body Chills (VIDEO) - April 25th, 2012 [April 25th, 2012]
- Red shirts divided over Prem meet - April 25th, 2012 [April 25th, 2012]
- Snobby Mr. Douchey - Ep: 6 - Video - May 4th, 2012 [May 4th, 2012]
- Ep. 3 MALLSCAPADE: Squaresville (A new free web show about growing up bored in the suburbs) - Video - May 4th, 2012 [May 4th, 2012]
- My Sisters: Problematic to Practically Perfect - Ep: 2 - Video - May 4th, 2012 [May 4th, 2012]
- Backstage Girls- Episode 2: Bobby Brown's Every Little Step - Video - May 4th, 2012 [May 4th, 2012]
- Red Heads for Red Heads with Cornelia Frances for The Orangutan Project - Video - May 4th, 2012 [May 4th, 2012]
- More Theatre of Life: Gay Witchcraft - Video - May 4th, 2012 [May 4th, 2012]
- Asian Red Head - Video - May 4th, 2012 [May 4th, 2012]
- Red Devils baseball team wins play-in game vs. North Sevier, heads to 2A tourney - May 5th, 2012 [May 5th, 2012]
- Ask Nick: Is something wrong with Gonzalez? - May 5th, 2012 [May 5th, 2012]
- Red Bluff Lady Spartans blast Lassen 13-0 - May 5th, 2012 [May 5th, 2012]
- Camelot heads 2,000 Guineas field - May 5th, 2012 [May 5th, 2012]
- Tech baseball heads to College Station for final time - May 5th, 2012 [May 5th, 2012]
- Joe Stortini heads list of local all-state basketball players - May 5th, 2012 [May 5th, 2012]
- 'White Rabbit, Red Rabbit' review: never the same - May 7th, 2012 [May 7th, 2012]
- Red sea of Clippers fans lifts team to win - May 7th, 2012 [May 7th, 2012]
- Reynolds and Hammel carry Orioles past Red Sox 8-2 - May 7th, 2012 [May 7th, 2012]
- Gillard, Abbott promote Red Cross - May 7th, 2012 [May 7th, 2012]
- The Duchess of Cambridge turns heads with glamorous cream dress - May 10th, 2012 [May 10th, 2012]
- Royals 4, Red Sox 3: Two out of three is bad - May 10th, 2012 [May 10th, 2012]
- The power of a sign - May 10th, 2012 [May 10th, 2012]
- Met Ball 2012 Red Carpet: Stars Shine In Metallic Frocks - May 10th, 2012 [May 10th, 2012]
- Morning Mail: Red Sox fan wears bag on head, starts social media storm - May 13th, 2012 [May 13th, 2012]
- 'Food Truck Wars' heads for Monmouth Park - May 13th, 2012 [May 13th, 2012]
- Obama to talk mortgages in Reno, Romney heads to North Carolina, plus more to watch for this weekend in politics - May 13th, 2012 [May 13th, 2012]
- Losing heads while salmon fishing - May 13th, 2012 [May 13th, 2012]
- West Ottawa boys track & field wins stunning relay at OK Red meet - May 13th, 2012 [May 13th, 2012]
- Sexy Redheads - Video - May 13th, 2012 [May 13th, 2012]
- Red Sox Look to Build Momentum Against Mariners: Fan Preview - May 16th, 2012 [May 16th, 2012]
- Red-cockaded woodpecker gets care and protection in Alabama (with video and gallery) - May 16th, 2012 [May 16th, 2012]
- Beckett takes Red Sox from Fenway to Bushwood - May 16th, 2012 [May 16th, 2012]
- Greek uncertainty leaves US stocks in red - May 16th, 2012 [May 16th, 2012]
- Greece Heads Toward New Elections - May 16th, 2012 [May 16th, 2012]
- On Soccer: Red Bulls rise to top of Eastern Conference with help from trio of young American defenders - May 16th, 2012 [May 16th, 2012]
- Frankel heads Lockinge confirmations - May 16th, 2012 [May 16th, 2012]
- Kevin Spacey heads to South Africa for movie project premiere - May 16th, 2012 [May 16th, 2012]
- Red Poppy brings new voices to art scene - May 16th, 2012 [May 16th, 2012]
- Gold Heads Into The Red In 2012 - May 17th, 2012 [May 17th, 2012]
- Betty White heads to Washington to see the animals - May 17th, 2012 [May 17th, 2012]
- Outdoors: Losing your heads against fishing rules - May 17th, 2012 [May 17th, 2012]
- Betty White heads to nation's capital to see National Zoo, indulge passion for animal watching - May 17th, 2012 [May 17th, 2012]
- Canadian wave heads to Cannes Film Festival - May 17th, 2012 [May 17th, 2012]
- Pippa Middleton Wears Sexy Red Dress at Scottish Wedding - May 20th, 2012 [May 20th, 2012]
- Touchdowns for a cure - May 20th, 2012 [May 20th, 2012]
- TSX heads higher; Facebook shares rise after delayed start of trading - May 20th, 2012 [May 20th, 2012]
- Woman heads to Uganda to bring cheer to children - May 20th, 2012 [May 20th, 2012]
- World Premiere of Disney•Pixar’s “Brave” Heads to Hollywood for Grand Opening of the Dolby Theatre - May 20th, 2012 [May 20th, 2012]
- Toronto stock market heads higher amid cautious buying at end of bruising week - May 20th, 2012 [May 20th, 2012]
- Red Bluff brings home 11th section title; McColpin throws shutout vs. Wolves - May 20th, 2012 [May 20th, 2012]