Dark Mode Plugin

Views: 901

Results 1 to 6 of 6
4 Dec 2025, 6:22 AM
#1
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,018
Plugin Contributions:
2

Dark Mode Plugin

Is there a plugin or template that provides customers with the ability to choose dark mode like I now see on wikipedia.

5 Dec 2025, 6:10 AM
#3
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,018
Plugin Contributions:
2

Re: Dark Mode Plugin

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

15 Dec 2025, 6:45 PM
#4
nldav avatar

nldav

New Zenner

Join Date:
Jan 2005
Posts:
55
Plugin Contributions:
0

Re: Dark Mode Plugin

dw08gm:

but does not say how to utilize system dark settings.

https://stackoverflow.com/questions/56393880/how-do-i-detect-dark-mode-using-javascript

to summarize, either use it directly in css

@media (prefers-color-scheme: dark)

but thats unwanted, what you want is alternate between css files. So

window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
const newColorScheme = event.matches ? "dark" : "light";
});

this would do the job.

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.

15 Dec 2025, 7:04 PM
#5
nldav avatar

nldav

New Zenner

Join Date:
Jan 2005
Posts:
55
Plugin Contributions:
0

Re: Dark Mode Plugin

I realize again that I am a bit vague. What I'm trying to say is that

window.matchMedia('(prefers-color-scheme: dark)')

returns the flag of the system setting (not the browser setting! See: https://stackoverflow.com/questions/78013261/why-window-matchmediaprefers-color-scheme-dark-matches-false-when-c )

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;

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();

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. :D

18 Dec 2025, 6:48 AM
#6
dw08gm avatar

dw08gm

Totally Zenned

Join Date:
Sep 2008
Location:
DownUnder, overlooking South Pole.
Posts:
1,018
Plugin Contributions:
2

Re: Dark Mode Plugin

Thanks for the links and adding clarity to the matter.