summaryrefslogtreecommitdiff
path: root/packages/frontend/src/theme.ts
diff options
context:
space:
mode:
authorsyuilo <4439005+syuilo@users.noreply.github.com>2025-08-26 20:17:25 +0900
committersyuilo <4439005+syuilo@users.noreply.github.com>2025-08-26 20:17:25 +0900
commit5e3d8fc9b87337f401221bef0c041e6ccf312fc5 (patch)
tree6f318ff762758eff339f086e8cb687e519c9315c /packages/frontend/src/theme.ts
parentrefactor (diff)
downloadmisskey-5e3d8fc9b87337f401221bef0c041e6ccf312fc5.tar.gz
misskey-5e3d8fc9b87337f401221bef0c041e6ccf312fc5.tar.bz2
misskey-5e3d8fc9b87337f401221bef0c041e6ccf312fc5.zip
refactor
Diffstat (limited to 'packages/frontend/src/theme.ts')
-rw-r--r--packages/frontend/src/theme.ts25
1 files changed, 16 insertions, 9 deletions
diff --git a/packages/frontend/src/theme.ts b/packages/frontend/src/theme.ts
index b715426917..4d03b1d0e9 100644
--- a/packages/frontend/src/theme.ts
+++ b/packages/frontend/src/theme.ts
@@ -3,6 +3,8 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
+// TODO: (可能な部分を)sharedに抽出して frontend-embed と共通化
+
import { ref, nextTick } from 'vue';
import tinycolor from 'tinycolor2';
import lightTheme from '@@/themes/_light.json5';
@@ -166,16 +168,21 @@ export function compile(theme: Theme): Record<string, string> {
return getColor(theme.props[val]);
} else if (val[0] === ':') { // func
const parts = val.split('<');
- const func = parts.shift().substring(1);
- const arg = parseFloat(parts.shift());
- const color = getColor(parts.join('<'));
+ const funcTxt = parts.shift();
+ const argTxt = parts.shift();
+
+ if (funcTxt && argTxt) {
+ const func = funcTxt.substring(1);
+ const arg = parseFloat(argTxt);
+ const color = getColor(parts.join('<'));
- switch (func) {
- case 'darken': return color.darken(arg);
- case 'lighten': return color.lighten(arg);
- case 'alpha': return color.setAlpha(arg);
- case 'hue': return color.spin(arg);
- case 'saturate': return color.saturate(arg);
+ switch (func) {
+ case 'darken': return color.darken(arg);
+ case 'lighten': return color.lighten(arg);
+ case 'alpha': return color.setAlpha(arg);
+ case 'hue': return color.spin(arg);
+ case 'saturate': return color.saturate(arg);
+ }
}
}