mirror of
https://github.com/appwrite/console.git
synced 2026-04-07 19:17:46 +00:00
19 lines
597 B
JavaScript
19 lines
597 B
JavaScript
(function () {
|
|
let themeInUse = 'auto';
|
|
const appwrite = localStorage.getItem('appwrite');
|
|
|
|
if (appwrite) {
|
|
try {
|
|
const localPrefs = JSON.parse(appwrite);
|
|
if (localPrefs) themeInUse = localPrefs.theme;
|
|
} catch (ignore) {
|
|
// Ignore any errors during JSON parsing
|
|
}
|
|
}
|
|
|
|
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
themeInUse = themeInUse === 'auto' ? (systemPrefersDark ? 'dark' : 'light') : themeInUse;
|
|
|
|
document.body.setAttribute('class', `theme-${themeInUse}`);
|
|
})();
|