lollms-webui/static/js/themechecker.js

8 lines
423 B
JavaScript
Raw Normal View History

2023-04-19 04:49:44 +00:00
// Default starts with dark mode.
document.documentElement.classList.add('dark');
// Changes theme based on user's device preference when page is loaded.
if (localStorage.getItem('color-theme') === 'dark' || (!('color-theme' in localStorage) && window.matchMedia('(prefers-color-scheme: dark)').matches)) {
document.documentElement.classList.add('dark');
} else {
document.documentElement.classList.remove('dark')
}