This content originally appeared on Bram.us and was authored by Bramus!
I’ve written about light-dark()
before here on bram.us, and last month I also wrote an article for web.dev about it.
The article takes a bit of a different approach, so it’s still worth a read even when you’ve seen my previous one before.
System colors have the ability to react to the current used
color-scheme
value. Thelight-dark()
function exposes the same capability to authors.
I’m especially fond of this demo that I built. The page responds to your Operating System’s light/dark setting but also allows overriding light/dark mode by changing the value of the color-scheme
to only light
or only dark
.
See the Pen
Color switching with light-dark() and color-scheme by web.dev (@web-dot-dev)
on CodePen.
CSS color-scheme
-dependent colors with light-dark()
→
This content originally appeared on Bram.us and was authored by Bramus!
Bramus! | Sciencx (2024-04-21T15:40:53+00:00) CSS color-scheme-dependent colors with light-dark(). Retrieved from https://www.scien.cx/2024/04/21/css-color-scheme-dependent-colors-with-light-dark/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.