From f4fd8328b5e38a883693191d2faec3e32ff7e33b Mon Sep 17 00:00:00 2001 From: Beef Date: Sun, 19 Mar 2023 17:46:57 +0000 Subject: [PATCH] [Themes] Properly theme raw colors --- src/lib/themes.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib/themes.ts b/src/lib/themes.ts index f1395c1..84da1de 100644 --- a/src/lib/themes.ts +++ b/src/lib/themes.ts @@ -126,11 +126,18 @@ export async function initThemes(color: any) { after("resolveSemanticColor", color.default.meta, (args, ret) => { if (!selectedTheme) return ret; - const colorSymbol = args[1] ?? ret; + const colorSymbol = args[1]; const colorProp = keys[refs.indexOf(colorSymbol)]; const themeIndex = args[0] === "amoled" ? 2 : args[0] === "light" ? 1 : 0; - return selectedTheme?.data?.semanticColors?.[colorProp]?.[themeIndex] ?? ret; + if (!selectedTheme.data?.semanticColors?.[colorProp]) { + const colorDef = color.SemanticColor[colorProp]; + if (typeof colorDef !== "object") return ret; + + return selectedTheme.data?.rawColors?.[colorDef[args[0]]?.raw] ?? ret; + } else { + return selectedTheme.data?.semanticColors?.[colorProp]?.[themeIndex] ?? ret; + } }); await updateThemes();