Can I use two different CSS for light and dark mode? #7515
-
Hi, I have this
And I was testing the light and dark mode palette, i.e., adding this to the
But I don't like the syntax highlighting when I use the dark mode. What I would really like is to be able to:
Is that possible? Many thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hello @rturrado,
and then add the attribute selector before your dark mode styles (yes, before every applicable selector):
.hljs {
color: #dcdccc;
background: #383838
}
/* ---> */
[data-md-color-scheme="slate"] .hljs {
color: #dcdccc;
background: #383838
} |
Beta Was this translation helpful? Give feedback.
Hello @rturrado,
you could technically modify what CSS is loaded using JavaScript, but I think the better way would be to just create your own
extra-highlight.css
file that combines both:and then add the attribute selector before your dark mode styles (yes, before every applicable selector):