diff options
author | Frankie B <floppydisk05@aol.com> | 2022-12-05 18:31:18 +0000 |
---|---|---|
committer | Frankie B <floppydisk05@aol.com> | 2022-12-05 18:31:18 +0000 |
commit | 8edb1c63695921ad65e0a3abcc04b66561f991c6 (patch) | |
tree | c121d4e4d7dc7e0e08f2be338ad98dc54c8ce25f /res/js/themeswap.js | |
parent | 2485f3ff0e06ac7a8f48486811251e3d7f478ee2 (diff) |
Light mode begone
Diffstat (limited to 'res/js/themeswap.js')
-rwxr-xr-x | res/js/themeswap.js | 26 |
1 files changed, 0 insertions, 26 deletions
diff --git a/res/js/themeswap.js b/res/js/themeswap.js deleted file mode 100755 index e619471..0000000 --- a/res/js/themeswap.js +++ /dev/null @@ -1,26 +0,0 @@ -function addStyleSheet(name, id) { - var path = '/res/css/' + name + '.css'; - var old = document.getElementById(id); - if (old && (old.href != path)) { - old.href = path; - } -} - -var otherTheme = { - 'dark': 'light', - 'light': 'dark', -}; - -var currentTheme = localStorage.getItem('theme'); - -if (!otherTheme.hasOwnProperty(currentTheme)) { - currentTheme = window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light'; -} - -addStyleSheet(currentTheme, 'theme'); - -function toggleTheme() { - currentTheme = otherTheme[currentTheme] || 'light'; - localStorage.setItem('theme', currentTheme); - addStyleSheet(currentTheme, 'theme'); -} |