Is there a plugin or template that provides customers with the ability to choose dark mode like I now see on wikipedia.
Is there a plugin or template that provides customers with the ability to choose dark mode like I now see on wikipedia.
funny that you mention it
https://www.zen-cart.com/showthread....79#post1409779
Here is a video explains the coding, but does not say how to utilize system dark settings.
How To Make Website DARK MODE | Dark Theme Website Design Using HTML, CSS & JS by How to Become a Developer
https://www.youtube.com/watch?v=rKqHbLuKaO8
https://stackoverflow.com/questions/...ing-javascript
to summarize, either use it directly in css
but thats unwanted, what you want is alternate between css files. So@media (prefers-color-scheme: dark)
this would do the job.window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
const newColorScheme = event.matches ? "dark" : "light";
});
I pretty much hacked a dark mode in our shop. Our shop still uses a very very old modified Winchester Responsive template (original from picaflor-azul) thats the reason I am not that helpful in explaining what I all did because its rare to begin with.
Last edited by nl2dav; 15 Dec 2025 at 07:49 PM.
I realize again that I am a bit vague. What I'm trying to say is that
returns the flag of the system setting (not the browser setting! See: https://stackoverflow.com/questions/...s-false-when-c )window.matchMedia('(prefers-color-scheme: dark)')
and if you have such flag (true or false) then you can change css file links on the fly with help of Javascript. Like that dude is doing with a favicon;
Although he falls back in light mode on Chrome due to some outstanding issue (?).. Its a comment from last year so maybe its fixed by now. Hopefully.const setFavicon = () => {
const favicon = document.querySelector('link[rel="icon"]');
const matchMedia = window.matchMedia('(prefers-color-scheme: dark)');
favicon.href = (window.matchMedia('(prefers-color-scheme: dark)').matches)
? 'path/to/dark-theme.png'
: 'path/to/light-theme.png';
if (navigator.userAgentData.brands[1].brand.includes('Chrome')) {
favicon.href = 'light-theme.png';
};
}
setFavicon();![]()
Last edited by nl2dav; 15 Dec 2025 at 08:09 PM.
Thanks for the links and adding clarity to the matter.