summaryrefslogtreecommitdiff
path: root/docs/public/theme.js
diff options
context:
space:
mode:
Diffstat (limited to 'docs/public/theme.js')
-rw-r--r--docs/public/theme.js12
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');
+ }
+})();