summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts/theme.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2023-10-09 15:37:58 +0900
committersyuilo <Syuilotan@yahoo.co.jp>2023-10-09 15:37:58 +0900
commit19a507633e18784a303adacbd416c709c128b69f (patch)
treed9df4c52681381484d0671d50c9476c2e0c9d54b /packages/frontend/src/scripts/theme.ts
parentrefactor (diff)
downloadsharkey-19a507633e18784a303adacbd416c709c128b69f.tar.gz
sharkey-19a507633e18784a303adacbd416c709c128b69f.tar.bz2
sharkey-19a507633e18784a303adacbd416c709c128b69f.zip
lint fixes
Diffstat (limited to 'packages/frontend/src/scripts/theme.ts')
-rw-r--r--packages/frontend/src/scripts/theme.ts24
1 files changed, 8 insertions, 16 deletions
diff --git a/packages/frontend/src/scripts/theme.ts b/packages/frontend/src/scripts/theme.ts
index 1c924e774f..b6383487c9 100644
--- a/packages/frontend/src/scripts/theme.ts
+++ b/packages/frontend/src/scripts/theme.ts
@@ -5,7 +5,11 @@
import { ref } from 'vue';
import tinycolor from 'tinycolor2';
-import { globalEvents } from '@/events';
+import { deepClone } from './clone.js';
+import { globalEvents } from '@/events.js';
+import lightTheme from '@/themes/_light.json5';
+import darkTheme from '@/themes/_dark.json5';
+import { miLocalStorage } from '@/local-storage.js';
export type Theme = {
id: string;
@@ -16,11 +20,6 @@ export type Theme = {
props: Record<string, string>;
};
-import lightTheme from '@/themes/_light.json5';
-import darkTheme from '@/themes/_dark.json5';
-import { deepClone } from './clone';
-import { miLocalStorage } from '@/local-storage.js';
-
export const themeProps = Object.keys(lightTheme.props).filter(key => !key.startsWith('X'));
export const getBuiltinThemes = () => Promise.all(
@@ -101,18 +100,11 @@ export function applyTheme(theme: Theme, persist = true) {
function compile(theme: Theme): Record<string, string> {
function getColor(val: string): tinycolor.Instance {
- // ref (prop)
- if (val[0] === '@') {
+ if (val[0] === '@') { // ref (prop)
return getColor(theme.props[val.substring(1)]);
- }
-
- // ref (const)
- else if (val[0] === '$') {
+ } else if (val[0] === '$') { // ref (const)
return getColor(theme.props[val]);
- }
-
- // func
- else if (val[0] === ':') {
+ } else if (val[0] === ':') { // func
const parts = val.split('<');
const func = parts.shift().substring(1);
const arg = parseFloat(parts.shift());