summaryrefslogtreecommitdiff
path: root/examples/doc/public/theme.js
diff options
context:
space:
mode:
authorGravatar Nate Moore <natemoo-re@users.noreply.github.com> 2021-05-27 09:16:14 -0500
committerGravatar GitHub <noreply@github.com> 2021-05-27 09:16:14 -0500
commit5247a23cbe534d79cdf4abe4c200a351dddc5dc2 (patch)
tree343c54fb5471998b4e1a9150d15ba63028548928 /examples/doc/public/theme.js
parent19dc517b87c3b6ad90c97bd220fe96becf27b196 (diff)
downloadastro-5247a23cbe534d79cdf4abe4c200a351dddc5dc2.tar.gz
astro-5247a23cbe534d79cdf4abe4c200a351dddc5dc2.tar.zst
astro-5247a23cbe534d79cdf4abe4c200a351dddc5dc2.zip
Example: Docs template (#226)
* fix: markdown issues * wip: add docs example * example: update doc template * chore: credit Steph for AvatarList * chore: align footer to bottom viewport * chore: feeback R1 * fix: font fallback in firefox * fix merge conflicts * fix: add default value to headers * chore: fix doc example
Diffstat (limited to 'examples/doc/public/theme.js')
-rw-r--r--examples/doc/public/theme.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/examples/doc/public/theme.js b/examples/doc/public/theme.js
new file mode 100644
index 000000000..1296b49b3
--- /dev/null
+++ b/examples/doc/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')
+ }
+})()