From 459b374d612e53cfd4244649ac2c812618f827f5 Mon Sep 17 00:00:00 2001 From: syuilo Date: Thu, 27 Sep 2018 19:14:35 +0900 Subject: wip --- src/client/app/common/scripts/theme.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/client/app/common/scripts') diff --git a/src/client/app/common/scripts/theme.ts b/src/client/app/common/scripts/theme.ts index a08028ff9a..db1cd7c394 100644 --- a/src/client/app/common/scripts/theme.ts +++ b/src/client/app/common/scripts/theme.ts @@ -7,6 +7,7 @@ type Theme = { id: string; name: string; inherit: string; + vars: any; }; } & { [key: string]: string; @@ -34,6 +35,22 @@ function compile(theme: Theme): { [key: string]: string } { if (code[0] == '@') { return getColor(theme[code.substr(1)]); } + if (code[0] == '$') { + return getColor(theme.meta.vars[code.substr(1)]); + } + + // func + if (code[0] == ':') { + const parts = code.split('<'); + const func = parts.shift().substr(1); + const arg = parseInt(parts.shift(), 10); + const color = getColor(parts.join('<')); + + switch (func) { + case 'darken': return color.darken(arg); + case 'lighten': return color.lighten(arg); + } + } return tinycolor(code); } -- cgit v1.2.3-freya