Skip to content

Instantly share code, notes, and snippets.

@ahmadajmi
Last active January 4, 2023 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmadajmi/fa6e5979484fbf404c20a4d15d755ea3 to your computer and use it in GitHub Desktop.
Save ahmadajmi/fa6e5979484fbf404c20a4d15d755ea3 to your computer and use it in GitHub Desktop.
// Replace YOUR_LIGHT_COLOR_HERE with your light background.
// Replace YOUR_DARK_COLOR_HERE in two lines with your dark background.
<style>
:root {
--nav-background: YOUR_LIGHT_COLOR_HERE;
}
@media (prefers-color-scheme: dark) {
:root:not([data-user-color-scheme]) {
--nav-background: YOUR_DARK_COLOR_HERE;
}
}
[data-user-color-scheme='dark'] {
--nav-background: YOUR_DARK_COLOR_HERE;
}
.c-nav-wrap {
background: var(--nav-background);
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment