Skip to content

Commit

Permalink
Merge branch 'master' of github.com:GoogleChromeLabs/dark-mode-toggle
Browse files Browse the repository at this point in the history
  • Loading branch information
tomayac committed Sep 16, 2019
2 parents dd51c77 + d2b0ada commit d89f3ee
Showing 1 changed file with 0 additions and 2 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ import * as DarkModeToggle from 'https://cdn.pika.dev/dark-mode-toggle';
const toggle = document.querySelector('dark-mode-toggle');
const body = document.body;

// Initialize the toggle based on `prefers-color-scheme`, defaulting to 'light'.
toggle.mode = matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
// Set or remove the `dark` class the first time.
toggle.mode === 'dark' ? body.classList.add('dark') : body.classList.remove('dark');

Expand Down

0 comments on commit d89f3ee

Please sign in to comment.