diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-09-27 19:14:35 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-09-27 19:14:35 +0900 |
| commit | 459b374d612e53cfd4244649ac2c812618f827f5 (patch) | |
| tree | d677a7ec329bb18a3113af6fee3f70242c936a2c /src/client/app/common/scripts | |
| parent | wip (diff) | |
| download | misskey-459b374d612e53cfd4244649ac2c812618f827f5.tar.gz misskey-459b374d612e53cfd4244649ac2c812618f827f5.tar.bz2 misskey-459b374d612e53cfd4244649ac2c812618f827f5.zip | |
wip
Diffstat (limited to 'src/client/app/common/scripts')
| -rw-r--r-- | src/client/app/common/scripts/theme.ts | 17 |
1 files changed, 17 insertions, 0 deletions
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); } |