summaryrefslogtreecommitdiff
path: root/src/client/theme.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/theme.ts')
-rw-r--r--src/client/theme.ts7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/client/theme.ts b/src/client/theme.ts
index 2a6adbffcc..e90c1f3a3b 100644
--- a/src/client/theme.ts
+++ b/src/client/theme.ts
@@ -102,3 +102,10 @@ function compile(theme: Theme): { [key: string]: string } {
function genValue(c: tinycolor.Instance): string {
return c.toRgbString();
}
+
+export function validateTheme(theme: Record<string, any>): boolean {
+ if (theme.id == null) return false;
+ if (theme.name == null) return false;
+ if (theme.base == null || !['light', 'dark'].includes(theme.base)) return false;
+ return true;
+}