-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: How do I change the style at runtime by clicking a button #2115
Comments
The highlight.js demo page shows you one way to do it: https://highlightjs.org/demo/ Each of the alternate stylesheets is included in a |
If you are using @use "sass:meta";
html[data-theme="light"] {
@include meta.load-css("highlight.js/styles/a11y-light");
}
html[data-theme="dark"] {
@include meta.load-css("highlight.js/styles/a11y-dark");
} To make it to work, you need to define the <html data-theme="light"> <!-- ensure to change it with javascript and define one with default -->
...
</html> |
@faunaee that link doesn't appear to work (anymore): |
Updated link to new demo page. |
I have highlight.js integrated into my website along with a style by including the corresponding css file. My website has light and dark modes. When the user changes the theme by clicking a button, I would also like to change the style (say from atom-one-light to atom-one-dark and vice versa) associated with highlight.js. If someone could please provide any pointer on how to do this that would be great.
The text was updated successfully, but these errors were encountered: