-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Support for multiple themes #807
Comments
Hi! Prism does not currently provide a way to do this out of the box, though you could probably change the selectors used in those themes to fit your needs. |
You'd have to scope the CSS or something to the context you want to highlight it in; I can't imagine how you'd support this by default, if you even wanted to. |
We could try to rely on selectors specificity, but this would require all themes to properly reset any property the default theme would have set... |
Hi, do you mean to say that I change the code and pre selectors in the css and js files of one of the themes to some other selectors and use the new selectors to style an element ? |
You shouldn't have to change anything in the JS. You just need to add a class name on every code blocks, for example: <pre class="dark-block language-css"><code> and change the dark theme like this, for example: code.dark-block[class*="language-"],
pre.dark-block[class*="language-"] { (just make sure you change all the required selectors in the theme) And you can do the same with the Coy theme. |
Thanks @Golmote that works. Please close this issue. |
To pick this up again, could something be added that uses the preferred-color-scheme media query to switch themes automatically? |
Also, switching themes automatically with this won't be easy since the theme being switched to will have to override all rules of the default theme. This is simply not the reality of Prism's themes, so it's not doable right now. |
I've managed to implement this by
Now Kotlin and TypeScript have different colours, which makes the difference more apparent. |
Is it possible to use multiple themes with the same app ? I want some piece of code using Coy and others using the Dark theme. Is there someway to do this ?
The text was updated successfully, but these errors were encountered: