Squashed 'themes/tabi-lean/' content from commit efb4246

git-subtree-dir: themes/tabi-lean
git-subtree-split: efb42461fde7ee5b0c140d27f2789fdf9c98b100
This commit is contained in:
Fabian Montero 2025-09-14 16:00:14 -06:00
commit 8be91ee3d9
336 changed files with 25227 additions and 0 deletions

View file

@ -0,0 +1,25 @@
(function () {
// Get the default theme from the HTML data-theme attribute.
const defaultTheme = document.documentElement.getAttribute('data-theme');
// Set the data-default-theme attribute only if defaultTheme is not null.
if (defaultTheme) {
document.documentElement.setAttribute('data-default-theme', defaultTheme);
}
// Attempt to retrieve the current theme from the browser's local storage.
const storedTheme = localStorage.getItem('theme');
if (storedTheme) {
document.documentElement.setAttribute('data-theme', storedTheme);
} else if (defaultTheme) {
document.documentElement.setAttribute('data-theme', defaultTheme);
} else {
// If no theme is found in local storage and no default theme is set, use user's system preference.
const isSystemDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
document.documentElement.setAttribute(
'data-theme',
isSystemDark ? 'dark' : 'light'
);
}
})();