Replies: 2 comments 2 replies
-
So let me just throw around some ideas:
the JS onload bit in the HTML element is just to make sure the attribute is set immediately and you will want to extend that so it gets the stored theme (from session or localStorage etc)
|
Beta Was this translation helpful? Give feedback.
-
Just throwing another idea there: You can have those svg's in variables, something like this (untested): :root {
--logo-dark: url("SOME SVG");
--logo: url("SOME SVG");
}
@media only screen and (prefers-color-scheme: dark) {
:root:not([data-theme=light]) {
--logo: var(--logo-dark);
}
}
[data-theme="dark"] {
--logo: var(--logo-dark);
}
#site-title {
font-size: 0;
}
#site-title:before {
content: var(--logo);
} <h1 id="site-title">Site Title</h1> |
Beta Was this translation helpful? Give feedback.
-
It would be useful to have a section in the documentation that covers how to apply light/dark mode to SVG images.
For example, I have a logo that has a color scheme for light mode and dark mode.
Light Mode Logo
Dark Mode Logo
I've seen some discussions online about how to handle this, but to have it explicitly covered in the Pico Css docs would be great.
How is everyone currently insuring that the right colors are applied to SVGs in light and dark mode?
Beta Was this translation helpful? Give feedback.
All reactions