Shared scss between dark/light mode #6653
-
DescriptionHi, I currently have a dark mode theme and a light mode theme, using something like
The theme-light.scss and theme-dark.scss files are identical, except at the head of the files I define colors. In the two files, I swap the color themes. E.g. theme-light.scss look like:
where-as theme-dark.scss has
All the rules and the settings are the same, but I reverse the color definitions (from My question is whether there is a better way of doing this that does not require keeping the two files synced. I tried moving the color definitions to file "light-colors.scss" and "dark-colors.scss" and the rest of the rules into "style.scss", then using
but it did not work. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
@josherrickson Could you add |
Beta Was this translation helpful? Give feedback.
-
This seems like a good solution, but you need to use correct order and correct content in each file
Then you need to load last, the scss with defines the variables needed in other scss file format:
html:
theme:
light: [cosmo, styles.scss, light.scss]
dark: [cosmo, styles.scss, dark.scss] More at https://quarto.org/docs/output-formats/html-themes.html#theme-options and https://quarto.org/docs/output-formats/html-themes-more.html#bootstrap-bootswatch-layering |
Beta Was this translation helpful? Give feedback.
-
Ah that's great thank you - I just assumed I needed to define the files from left to right. Thanks. |
Beta Was this translation helpful? Give feedback.
This seems like a good solution, but you need to use correct order and correct content in each file
Then you need to load last, the scss with defines the variables needed in other scss file