diff options
author | 2021-07-15 14:13:35 -0400 | |
---|---|---|
committer | 2021-07-15 14:13:35 -0400 | |
commit | 166e22bdf35b9751dc42f5cc6cb27a99b077df93 (patch) | |
tree | e8643360c2250dda82ebf95b62281978547d5188 /docs/public/theme.js | |
parent | fb8bf7ec43f7b09348c12d5ff9f81131c70ef5e9 (diff) | |
download | astro-166e22bdf35b9751dc42f5cc6cb27a99b077df93.tar.gz astro-166e22bdf35b9751dc42f5cc6cb27a99b077df93.tar.zst astro-166e22bdf35b9751dc42f5cc6cb27a99b077df93.zip |
merge in docs site (#705)
Diffstat (limited to 'docs/public/theme.js')
-rw-r--r-- | docs/public/theme.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/public/theme.js b/docs/public/theme.js new file mode 100644 index 000000000..91abd5504 --- /dev/null +++ b/docs/public/theme.js @@ -0,0 +1,12 @@ +(() => { + 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'); + } +})(); |