Skip to content

Instantly share code, notes, and snippets.

@laurelstreng
Created December 9, 2024 12:56
Show Gist options
  • Save laurelstreng/e711fb59b1414eed0fe523ccb4762965 to your computer and use it in GitHub Desktop.
Save laurelstreng/e711fb59b1414eed0fe523ccb4762965 to your computer and use it in GitHub Desktop.
CSS – Dark Mode
/**
* 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