-
Notifications
You must be signed in to change notification settings - Fork 14
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
Autoswitching plots depending on documentation theme? #124
Comments
Have you added that CSS to the The correct approach for Vitepress is to append
|
Yes, I have added the CSS from that issue to |
You don't need the style if you use the Markdown I linked ;) |
Many thanks for the clarification. I have tried adding the Markdown you linked, but it is displaying both images at the same time, instead of selecting based on theme. |
@asinghvi17 by any chance do you have any further suggestions regarding this? |
I had to tinker to get this to work. But /* Switching between light/dark theme plots */
:root:not(.dark) .dark-only {
display: none;
}
:root:is(.dark) .light-only {
display: none;
}
:root:not(.dark) .light-only {
display: block;
}
:root:is(.dark) .dark-only {
display: block;
} in a css file (docs/src/.vitepress/theme/style.css, or some custom.css that you link to in docs/src/.vitepress/theme/index.ts) enabled
where the empty line between these seems necessary for some reason. Just posting in case anyone else comes across this. |
Huh, thanks! I didn't realize that this wasn't working on other Vitepress sites, maybe it's not in the default DocumenterVitepress CSS. I'll look into other methods depending on what Vitepress supports natively, but that CSS method seems to be pretty good as well! |
Hi, I would like for the plots in my documentation to be automatically changed depending on the theme of the documentation (light/dark). This is possible using the plain
Documenter.HTML
(see JuliaDocs/Documenter.jl#1578), but breaks when usingDocumenterVitepress.MarkdownVitepress
- would you have any advice on how to do this?The text was updated successfully, but these errors were encountered: