Search code examples
htmlcssdarkmode

Force light mode when browser is set to dark mode


When the browser is set to dark mode a filter is set which makes my sections darker. I don't want that to happen. I tried forcing light mode with:

<meta name="color-scheme" content="only light">

but this doesn't work on all browsers. I don't know how to work around or fix this.

Dark mode on: Dark mode on

Dark mode off: Dark mode off


Solution

  • Just use data-theme on your html tag.

    <html data-theme="light">
    ...
    </html>