add ability to override underlay color/opacity regardless of theme

This commit is contained in:
Henry Jameson 2024-07-16 21:01:20 +03:00
commit a378c999b7
6 changed files with 54 additions and 16 deletions

View file

@ -282,12 +282,12 @@ const config = {
}
} else {
commit('setOption', { name, value })
if (
name.startsWith('theme3hacks') ||
APPEARANCE_SETTINGS_KEYS.has(name)
) {
if (APPEARANCE_SETTINGS_KEYS.has(name)) {
applyConfig(state)
}
if (name.startsWith('theme3hacks')) {
dispatch('setTheme', { recompile: true })
}
switch (name) {
case 'theme':
dispatch('setTheme', { themeName: value, recompile: true })

View file

@ -221,7 +221,8 @@ const interfaceMod = {
customTheme: userThemeSnapshot,
customThemeSource: userThemeSource,
forceThemeRecompilation,
themeDebug
themeDebug,
theme3hacks
} = rootState.config
const forceRecompile = forceThemeRecompilation || recompile
@ -275,7 +276,36 @@ const interfaceMod = {
promise
.then(realThemeData => {
const ruleset = convertTheme2To3(realThemeData)
const theme2ruleset = convertTheme2To3(realThemeData)
const hacks = []
Object.entries(theme3hacks).forEach(([key, value]) => {
switch (key) {
case 'underlay': {
if (value !== 'none') {
const newRule = {
component: 'Underlay',
directives: {}
}
if (value === 'opaque') {
newRule.directives.opacity = 1
newRule.directives.background = '--wallpaper'
}
if (value === 'transparent') {
newRule.directives.opacity = 0
}
console.log('NEW RULE', newRule)
hacks.push(newRule)
}
break
}
}
})
const ruleset = [
...theme2ruleset,
...hacks
]
applyTheme(
ruleset,