Skip to content

Instantly share code, notes, and snippets.

@lior-amsalem
Created July 16, 2022 11:08
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 lior-amsalem/418265bcd5b72a2bf9eedb65b9ae3eda to your computer and use it in GitHub Desktop.
Save lior-amsalem/418265bcd5b72a2bf9eedb65b9ae3eda to your computer and use it in GitHub Desktop.
body[data-theme="light"] {
--app-background-color-200: #272727;
/* we can apply more css selectors colors here */
}
body[data-theme="dark"] {
--app-background-color-200: #787878;
/* we can apply more css selectors colors here */
}
/* apply css vars to a specific body data attribute means that we don’t have to refer to the theme within our css code. Like example below: */
.app-wrapper {
/* here we use app background color 200 once, but the color will change base on what we define on the body data attribute */
background-color: var(--app-background-color-200);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment