summaryrefslogtreecommitdiff
path: root/packages/client/src/scripts/theme.ts
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2022-06-11 19:31:03 +0900
committerGitHub <noreply@github.com>2022-06-11 19:31:03 +0900
commit182a1bf653ecfbcf76e4530b3077c6252b0d4827 (patch)
tree45d1472747d4cac017e96616f844292f5785ccdd /packages/client/src/scripts/theme.ts
parent12.110.1 (diff)
parent12.111.0 (diff)
downloadsharkey-182a1bf653ecfbcf76e4530b3077c6252b0d4827.tar.gz
sharkey-182a1bf653ecfbcf76e4530b3077c6252b0d4827.tar.bz2
sharkey-182a1bf653ecfbcf76e4530b3077c6252b0d4827.zip
Merge pull request #8783 from misskey-dev/develop
Release: 12.111.0
Diffstat (limited to 'packages/client/src/scripts/theme.ts')
-rw-r--r--packages/client/src/scripts/theme.ts51
1 files changed, 30 insertions, 21 deletions
diff --git a/packages/client/src/scripts/theme.ts b/packages/client/src/scripts/theme.ts
index 2cb78fae5c..dec9fb355c 100644
--- a/packages/client/src/scripts/theme.ts
+++ b/packages/client/src/scripts/theme.ts
@@ -1,5 +1,6 @@
+import { ref } from 'vue';
import { globalEvents } from '@/events';
-import * as tinycolor from 'tinycolor2';
+import tinycolor from 'tinycolor2';
export type Theme = {
id: string;
@@ -10,30 +11,38 @@ export type Theme = {
props: Record<string, string>;
};
-export const lightTheme: Theme = require('@/themes/_light.json5');
-export const darkTheme: Theme = require('@/themes/_dark.json5');
+import lightTheme from '@/themes/_light.json5';
+import darkTheme from '@/themes/_dark.json5';
export const themeProps = Object.keys(lightTheme.props).filter(key => !key.startsWith('X'));
-export const builtinThemes = [
- require('@/themes/l-light.json5'),
- require('@/themes/l-coffee.json5'),
- require('@/themes/l-apricot.json5'),
- require('@/themes/l-rainy.json5'),
- require('@/themes/l-vivid.json5'),
- require('@/themes/l-cherry.json5'),
- require('@/themes/l-sushi.json5'),
+export const getBuiltinThemes = () => Promise.all(
+ [
+ 'l-light',
+ 'l-coffee',
+ 'l-apricot',
+ 'l-rainy',
+ 'l-vivid',
+ 'l-cherry',
+ 'l-sushi',
- require('@/themes/d-dark.json5'),
- require('@/themes/d-persimmon.json5'),
- require('@/themes/d-astro.json5'),
- require('@/themes/d-future.json5'),
- require('@/themes/d-botanical.json5'),
- require('@/themes/d-cherry.json5'),
- require('@/themes/d-ice.json5'),
- require('@/themes/d-pumpkin.json5'),
- require('@/themes/d-black.json5'),
-] as Theme[];
+ 'd-dark',
+ 'd-persimmon',
+ 'd-astro',
+ 'd-future',
+ 'd-botanical',
+ 'd-cherry',
+ 'd-ice',
+ 'd-pumpkin',
+ 'd-black',
+ ].map(name => import(`../themes/${name}.json5`).then(({ default: _default }): Theme => _default))
+);
+
+export const getBuiltinThemesRef = () => {
+ const builtinThemes = ref<Theme[]>([]);
+ getBuiltinThemes().then(themes => builtinThemes.value = themes);
+ return builtinThemes;
+};
let timeout = null;