mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
theme: do not throw error if deprecated color is found
This commit is contained in:
committed by
Abdullah Atta
parent
d1c724563f
commit
1f5a5afb10
@@ -319,3 +319,5 @@ export const Variants: readonly (keyof Variants)[] = [
|
||||
"error",
|
||||
"success"
|
||||
];
|
||||
|
||||
export const DEPRECATED_COLORS = ["shade", "textSelection"];
|
||||
|
||||
@@ -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}.`
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user