diff options
author | 2021-06-08 08:10:56 -0700 | |
---|---|---|
committer | 2021-06-08 11:10:56 -0400 | |
commit | 6bca7c83a7e2d62015f45f873b0f69f11b4d902b (patch) | |
tree | 5662630e51c6e6e743785d308785cff2e47568f0 /examples/docs/public/theme.js | |
parent | 9594447335b7fa15f82c0789f18a3fe02ec20d70 (diff) | |
download | astro-6bca7c83a7e2d62015f45f873b0f69f11b4d902b.tar.gz astro-6bca7c83a7e2d62015f45f873b0f69f11b4d902b.tar.zst astro-6bca7c83a7e2d62015f45f873b0f69f11b4d902b.zip |
redesign create-astro (#301)
* redesign create astro
* add changeset
* Use npm start
* Update the astro version
* Adds the changeset
Co-authored-by: Fred Schott <fks@Freds-MBP.attlocal.net>
Co-authored-by: Matthew Phillips <matthew@skypack.dev>
Diffstat (limited to 'examples/docs/public/theme.js')
-rw-r--r-- | examples/docs/public/theme.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/docs/public/theme.js b/examples/docs/public/theme.js new file mode 100644 index 000000000..d75d0bf99 --- /dev/null +++ b/examples/docs/public/theme.js @@ -0,0 +1,8 @@ +(() => { + const root = document.documentElement; + if (localStorage.theme === 'dark' || (!('theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) { + root.classList.add('theme-dark'); + } else { + root.classList.remove('theme-dark'); + } +})(); |