Revert "feat: light/dark theme toggle"

This reverts commit bb0068a4e9.
This commit is contained in:
Cory Dransfeldt 2024-02-12 20:47:09 -08:00
parent bcdbdfab29
commit 4a543742f7
No known key found for this signature in database
8 changed files with 7 additions and 80 deletions

View file

@ -1,5 +1,5 @@
if (window.location.hostname !== 'localhost') {
;(async function() {
;(async function () {
const nowPlaying = document.getElementById('now-playing')
if (nowPlaying) {
@ -39,30 +39,3 @@ if (window.location.hostname !== 'localhost') {
}
})()
}
;(async function() {
const btn = document.querySelector('.theme__toggle');
const prefersDarkScheme = window.matchMedia('(prefers-color-scheme: dark)').matches;
const currentTheme = localStorage?.getItem('theme');
let theme;
if (!currentTheme) localStorage?.setItem('theme', (prefersDarkScheme ? 'dark' : 'light'))
if (currentTheme === 'dark') {
document.body.classList.toggle('theme__dark');
} else if (currentTheme === 'light') {
document.body.classList.toggle('theme__light');
}
btn.addEventListener('click', () => {
console.log(prefersDarkScheme)
if (prefersDarkScheme) {
document.body.classList.toggle('theme__light');
theme = document.body.classList.contains('theme__light') ? 'light' : 'dark';
} else {
document.body.classList.toggle('theme__dark');
theme = document.body.classList.contains('theme__dark') ? 'dark' : 'light';
}
localStorage?.setItem('theme', theme);
});
})()