Angelika Cathor on Nostr: I got excited at the idea of calc/clamping color lightness in hsl() only to discover ...
I got excited at the idea of calc/clamping color lightness in hsl() only to discover that there is no way to do it that will work in all browsers 😢.
Adding percentages works in Safari, doesn't work in FF and Chrome:
background-color: hsl(from #ff00ff h s calc(l + 30%))
Adding numbers works in FF and Chrome, doesn't work in Safari:
background-color: hsl(from #ff00ff h s calc(l + 30))
Here's a code pen:
https://codepen.io/angelikatyborska/pen/MYgwJyvPlease somebody tell me that I'm wrong?
#CSS #WebDev
Published at
2024-12-01 14:55:04Event JSON
{
"id": "4bf96c160cc2f265fbebb74b6050bc658dbfcdd2619eadf16c2f60cbb6c64520",
"pubkey": "54983cf0c7a54bf2e58720c2edbafb9fa77569d0e248be6dfc67c57d186bc1cd",
"created_at": 1733064904,
"kind": 1,
"tags": [
[
"t",
"webdev"
],
[
"t",
"css"
],
[
"t",
"ff00ff"
],
[
"proxy",
"https://mas.to/users/angelikatyborska/statuses/113578141585916483",
"activitypub"
]
],
"content": "I got excited at the idea of calc/clamping color lightness in hsl() only to discover that there is no way to do it that will work in all browsers 😢. \n\nAdding percentages works in Safari, doesn't work in FF and Chrome:\nbackground-color: hsl(from #ff00ff h s calc(l + 30%))\n\nAdding numbers works in FF and Chrome, doesn't work in Safari:\nbackground-color: hsl(from #ff00ff h s calc(l + 30))\n\nHere's a code pen: https://codepen.io/angelikatyborska/pen/MYgwJyv\n\nPlease somebody tell me that I'm wrong?\n\n#CSS #WebDev",
"sig": "b4d81c5626879906bf94429be21ba96133738f2fe990ae1bde523c17f6fa74a759b34a0d275f97ea794e0477f4ef090e8f0868fbffe92a100f177b92859804c2"
}