INNER CODE UNIT · Python

getPreferredTheme

SHAdd0WTAka/Zen-Ai-Pentest · api/main.py:669

        function getPreferredTheme() {
            const savedTheme = localStorage.getItem(THEME_KEY);
            if (savedTheme) return savedTheme;
            return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
        }
        function applyTheme(theme) {
            document.body.setAttribute('data-theme', theme);
            const icon = document.getElementById('themeIcon');
            const text = document.getElementById('themeText');
            if (theme === 'dark') { icon.textContent = 'Sun'; text.textContent = 'Light'; }
            else { icon.textContent = 'Moon'; text.textContent = 'Dark'; }
        }
        function toggleTheme() {
            const currentTheme = document.body.getAttribute('data-theme');
            const newTheme = currentTheme === 'dark' ? 'light' : 'dark';
            localStorage.setItem(THEME_KEY, newTheme);
            applyTheme(newTheme);
        }

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…