Re:How to have the browser pick a contrasting color in CSS
by natemwilson on Saturday May 17, 2025 @04:38PM
(#44016837)
I’ve never seen any CSS function that has this call back style where you get parameters that you can modify. So interesting! Are there any other examples of this or is this unique to lch?
[ Parent
| on HN ]
Re:How to have the browser pick a contrasting color in CSS
by fireflies_ on Saturday May 17, 2025 @04:44PM
(#44016871)
This is "relative color" syntax, it works with a range of color spaces/color functions. The key is the "from" at the front. Here's the MDN documentation: https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_colors/...
Re:How to have the browser pick a contrasting color in CSS
by KTibow on Saturday May 17, 2025 @07:56PM
(#44017903)
Some newer ones like calc-size are also like this.
Re:How to have the browser pick a contrasting color in CSS
by halflife on Saturday May 17, 2025 @04:45PM
(#44016874)
It may be confusing, but everything here is static param. The —- prefix is css variables, where inside a css declaration block you write: —bg: blue
Re:How to have the browser pick a contrasting color in CSS
by natemwilson on Saturday May 17, 2025 @09:20PM
(#44018254)
The `l` isn't!