Is there a way to force Dark Mode on a website on macOS for Safari?

580 Views Asked by At

I've attempted

@media (prefers-color-scheme dark)

but it doesn't seem like that works for macOS on Safari? Works just fine on iOS Safari so I'm kind of confused. Is there a way to create like a fallback in case that doesn't work and the page defaults to a white page? Basically if @media (prefers-color-scheme dark) doesn't work, and the page defaults to light mode, is there any way to create a fallback so that it'll show it in dark mode before loading the page with light mode?

1

There are 1 best solutions below

2
On

Im not positive about what you want but I think setting the "@media (prefers-color-scheme: light){" to a dark background would function as a fallback. something like https://codepen.io/jonneal/pen/vzPwWo @media (prefers-color-scheme: light) {