mirror of
https://gitlab.com/ArkHost/HelixNotes.git
synced 2026-11-23 19:04:56 +01:00
Fix custom themes falling back to light divider and tertiary text colors
This commit is contained in:
1 parent
2dd0985ea9
commit
3e8aa7f10d
2 files changed
+12
-1
No files matched your search
@@ -585,12 +585,14 @@
|
|||||||
root.style.setProperty('--text-primary', customThemeEditing.colors.text_primary);
|
root.style.setProperty('--text-primary', customThemeEditing.colors.text_primary);
|
||||||
root.style.setProperty('--text-secondary', customThemeEditing.colors.text_secondary);
|
root.style.setProperty('--text-secondary', customThemeEditing.colors.text_secondary);
|
||||||
root.style.setProperty('--border-color', customThemeEditing.colors.border_color);
|
root.style.setProperty('--border-color', customThemeEditing.colors.border_color);
|
||||||
|
root.style.setProperty('--border-light', customThemeEditing.colors.border_color);
|
||||||
|
root.style.setProperty('--text-tertiary', customThemeEditing.colors.text_secondary);
|
||||||
root.classList.toggle('dark', customThemeEditing.is_dark);
|
root.classList.toggle('dark', customThemeEditing.is_dark);
|
||||||
}
|
}
|
||||||
|
|
||||||
function restoreCurrentTheme() {
|
function restoreCurrentTheme() {
|
||||||
const root = document.documentElement;
|
const root = document.documentElement;
|
||||||
const varsToClear = ['--bg-primary','--bg-secondary','--bg-tertiary','--bg-hover','--bg-active','--bg-editor','--text-primary','--text-secondary','--border-color'];
|
const varsToClear = ['--bg-primary','--bg-secondary','--bg-tertiary','--bg-hover','--bg-active','--bg-editor','--text-primary','--text-secondary','--border-color','--border-light','--text-tertiary'];
|
||||||
root.classList.remove('dark');
|
root.classList.remove('dark');
|
||||||
root.removeAttribute('data-theme');
|
root.removeAttribute('data-theme');
|
||||||
for (const v of varsToClear) root.style.removeProperty(v);
|
for (const v of varsToClear) root.style.removeProperty(v);
|
||||||
@@ -607,6 +609,8 @@
|
|||||||
root.style.setProperty('--text-primary', ct.colors.text_primary);
|
root.style.setProperty('--text-primary', ct.colors.text_primary);
|
||||||
root.style.setProperty('--text-secondary', ct.colors.text_secondary);
|
root.style.setProperty('--text-secondary', ct.colors.text_secondary);
|
||||||
root.style.setProperty('--border-color', ct.colors.border_color);
|
root.style.setProperty('--border-color', ct.colors.border_color);
|
||||||
|
root.style.setProperty('--border-light', ct.colors.border_color);
|
||||||
|
root.style.setProperty('--text-tertiary', ct.colors.text_secondary);
|
||||||
if (ct.is_dark) root.classList.add('dark');
|
if (ct.is_dark) root.classList.add('dark');
|
||||||
}
|
}
|
||||||
} else if (namedThemes.includes($theme)) {
|
} else if (namedThemes.includes($theme)) {
|
||||||
|
|||||||
@@ -26,8 +26,13 @@
|
|||||||
'--bg-primary', '--bg-secondary', '--bg-tertiary',
|
'--bg-primary', '--bg-secondary', '--bg-tertiary',
|
||||||
'--bg-hover', '--bg-active', '--bg-editor',
|
'--bg-hover', '--bg-active', '--bg-editor',
|
||||||
'--text-primary', '--text-secondary', '--border-color',
|
'--text-primary', '--text-secondary', '--border-color',
|
||||||
|
'--border-light', '--text-tertiary',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// A custom theme carries nine colors, but the stylesheet also reads --border-light and
|
||||||
|
// --text-tertiary. Named themes set those in their own :root[data-theme] block; a custom theme
|
||||||
|
// has no such block, so without these they fall back to the light defaults in app.css and a dark
|
||||||
|
// custom theme draws near-white dividers. Derive them from the closest color the theme does have.
|
||||||
function applyCustomThemeVars(root: HTMLElement, ct: CustomTheme) {
|
function applyCustomThemeVars(root: HTMLElement, ct: CustomTheme) {
|
||||||
root.style.setProperty('--bg-primary', ct.colors.bg_primary);
|
root.style.setProperty('--bg-primary', ct.colors.bg_primary);
|
||||||
root.style.setProperty('--bg-secondary', ct.colors.bg_secondary);
|
root.style.setProperty('--bg-secondary', ct.colors.bg_secondary);
|
||||||
@@ -38,6 +43,8 @@
|
|||||||
root.style.setProperty('--text-primary', ct.colors.text_primary);
|
root.style.setProperty('--text-primary', ct.colors.text_primary);
|
||||||
root.style.setProperty('--text-secondary', ct.colors.text_secondary);
|
root.style.setProperty('--text-secondary', ct.colors.text_secondary);
|
||||||
root.style.setProperty('--border-color', ct.colors.border_color);
|
root.style.setProperty('--border-color', ct.colors.border_color);
|
||||||
|
root.style.setProperty('--border-light', ct.colors.border_color);
|
||||||
|
root.style.setProperty('--text-tertiary', ct.colors.text_secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearCustomThemeVars(root: HTMLElement) {
|
function clearCustomThemeVars(root: HTMLElement) {
|
||||||
|
|||||||
Reference in new issue
Block a user