[Themes] Properly theme raw colors
This commit is contained in:
parent
85a83e4873
commit
f4fd8328b5
1 changed files with 9 additions and 2 deletions
|
@ -126,11 +126,18 @@ export async function initThemes(color: any) {
|
||||||
after("resolveSemanticColor", color.default.meta, (args, ret) => {
|
after("resolveSemanticColor", color.default.meta, (args, ret) => {
|
||||||
if (!selectedTheme) return ret;
|
if (!selectedTheme) return ret;
|
||||||
|
|
||||||
const colorSymbol = args[1] ?? ret;
|
const colorSymbol = args[1];
|
||||||
const colorProp = keys[refs.indexOf(colorSymbol)];
|
const colorProp = keys[refs.indexOf(colorSymbol)];
|
||||||
const themeIndex = args[0] === "amoled" ? 2 : args[0] === "light" ? 1 : 0;
|
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();
|
await updateThemes();
|
||||||
|
|
Loading…
Reference in a new issue