Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

theme: do not throw error if deprecated color is found

Abdullah Atta1f5a5afb107c
diff --git a/packages/theme/src/theme-engine/types.ts b/packages/theme/src/theme-engine/types.ts
index 2bb7e2636..6a4f16ff3 100644
--- a/packages/theme/src/theme-engine/types.ts
+++ b/packages/theme/src/theme-engine/types.ts
@@ -319,3 +319,5 @@ export const Variants: readonly (keyof Variants)[] = [
"error",
"success"
];
+
+export const DEPRECATED_COLORS = ["shade", "textSelection"];
diff --git a/packages/theme/src/theme-engine/validator.ts b/packages/theme/src/theme-engine/validator.ts
index 6ed473964..df49fccfb 100644
--- a/packages/theme/src/theme-engine/validator.ts
+++ b/packages/theme/src/theme-engine/validator.ts
@@ -21,6 +21,7 @@ import {
ALPHA_COLORS,
COLORS,
Colors,
+ DEPRECATED_COLORS,
ThemeDefinition,
Variants
} from "./types";
@@ -72,7 +73,10 @@ export function validateTheme(json: Partial<ThemeDefinition>): {
for (const key in flattenedTheme) {
if (!key.startsWith("scopes")) continue;
const keyPart = key.split(".").pop() as keyof Colors | undefined;
- if (!keyPart || !COLORS.includes(keyPart))
+ if (
+ !keyPart ||
+ (!COLORS.includes(keyPart) && !DEPRECATED_COLORS.includes(keyPart))
+ )
return {
error: `Invalid theme. Found unknown key: ${key}.`
};