Created
December 9, 2024 12:56
-
-
Save laurelstreng/e711fb59b1414eed0fe523ccb4762965 to your computer and use it in GitHub Desktop.
CSS – Dark Mode
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* CSS Dark Mode | |
* | |
* Declare color-scheme: light dark in the :root. | |
* Then use the light-dark() function to set both colors. | |
**/ | |
:root { | |
color-scheme: light dark; | |
--bg-color: light-dark(white, black); | |
--text-color: light-dark(black, white); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment