Improve announcement rendering and theme assets

This commit is contained in:
2026-08-26 01:08:59 +01:00
parent a7d867dd6f
commit 9097d45d6a
16 changed files with 97 additions and 32 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -2429,7 +2429,7 @@ html[data-bs-theme='dark'] .template-field-card .tox .tox-collection {
.announcement-color-picker__grid {
display: grid;
grid-template-columns: repeat(8, minmax(0, 1fr));
grid-template-columns: repeat(auto-fit, minmax(5.5rem, 1fr));
gap: 0.375rem;
}
+17 -16
View File
@@ -2,25 +2,26 @@
(function () {
var storageKey = 'lte-theme';
var theme = 'dark';
function getPreferredTheme() {
if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {
return 'dark';
}
return 'light';
}
var root = document.documentElement;
var authoredTheme = root.getAttribute('data-bs-theme');
var theme = authoredTheme === 'light' || authoredTheme === 'dark' ? authoredTheme : 'dark';
var storedTheme = null;
try {
var storedTheme = window.localStorage.getItem(storageKey);
if (storedTheme === 'dark' || storedTheme === 'light' || storedTheme === 'auto') {
theme = storedTheme === 'auto' ? getPreferredTheme() : storedTheme;
}
storedTheme = window.localStorage.getItem(storageKey);
} catch (error) {
theme = 'dark';
storedTheme = null;
}
document.documentElement.dataset.bsTheme = theme;
document.documentElement.style.colorScheme = theme;
if (storedTheme === 'light' || storedTheme === 'dark') {
theme = storedTheme;
} else if (storedTheme === 'auto' || (authoredTheme !== 'light' && authoredTheme !== 'dark')) {
theme = window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
}
root.setAttribute('data-bs-theme', theme);
root.style.colorScheme = theme;
if (theme !== authoredTheme) {
root.setAttribute('data-lte-theme-resolved', '');
}
}());