update plugin themes when plugin was updated (#20052)

This commit is contained in:
Sebastian 2026-03-30 13:51:07 +02:00 committed by GitHub
commit 8e4bab5181
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 237 additions and 38 deletions

View file

@ -183,6 +183,18 @@ export function addTheme(name: string, theme: unknown) {
return true
}
export function upsertTheme(name: string, theme: unknown) {
if (!name) return false
if (!isTheme(theme)) return false
if (customThemes[name] !== undefined) {
customThemes[name] = theme
} else {
pluginThemes[name] = theme
}
syncThemes()
return true
}
export function resolveTheme(theme: ThemeJson, mode: "dark" | "light") {
const defs = theme.defs ?? {}
function resolveColor(c: ColorValue, chain: string[] = []): RGBA {