Skip to content

Commit f52c48d

Browse files
committed
Fix prefers-color-scheme support check, credits: @emilio
1 parent ee73d57 commit f52c48d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dark-mode-toggle",
3-
"version": "0.0.12",
3+
"version": "0.1.0",
44
"description": "Web Component that toggles dark mode 🌒",
55
"main": "./src/dark-mode-toggle.mjs",
66
"browser": "src/dark-mode-toggle.mjs",

src/dark-mode-toggle.mjs

+1-1
Original file line numberDiff line numberDiff line change
@@ -301,7 +301,7 @@ export class DarkModeToogle extends HTMLElement {
301301

302302
// Does the browser support native `prefers-color-scheme`?
303303
const hasNativePrefersColorScheme =
304-
win.matchMedia('(prefers-color-scheme)').matches;
304+
win.matchMedia('(prefers-color-scheme)').media !== 'not all';
305305
// Set initial state, giving preference to a remembered value, then the
306306
// native value (if supported), and eventually defaulting to a light
307307
// experience.

0 commit comments

Comments
 (0)