Files
Wallos/scripts/login.js
Miguel Ribeiro c2e85d6e10 feat: support automatic dark mode
refactor: run linter and cleanup php files
fix: not every payment cycle was shown on the calendar
feat: also show previous payments on the calendar for the current month
2024-06-26 18:11:37 +02:00

18 lines
914 B
JavaScript

document.addEventListener('DOMContentLoaded', function () {
if (window.update_theme_settings) {
const prefersDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
const themePreference = prefersDarkMode ? 'dark' : 'light';
const darkThemeCss = document.querySelector("#dark-theme");
darkThemeCss.disabled = themePreference === 'light';
document.body.className = themePreference;
const themeColorMetaTag = document.querySelector('meta[name="theme-color"]');
themeColorMetaTag.setAttribute('content', themePreference === 'dark' ? '#222222' : '#FFFFFF');
const logoImage = document.querySelector('#wallos-logo');
const imageName = themePreference === 'dark' ? 'walloswhite' : 'wallos';
const colorTheme = window.color_theme ?? 'blue';
logoImage.src = `images/siteicons/${colorTheme}/${imageName}.png`;
}
});