summaryrefslogtreecommitdiff
path: root/packages/frontend/src/scripts/theme.ts
diff options
context:
space:
mode:
authorかっこかり <67428053+kakkokari-gtyih@users.noreply.github.com>2024-02-06 15:03:07 +0900
committerGitHub <noreply@github.com>2024-02-06 15:03:07 +0900
commit16eccad49271b81282cdbd482d29e7a8bb048f4c (patch)
tree96f0b6f94f106de95ff8cb9af29b39b53fdeaece /packages/frontend/src/scripts/theme.ts
parent2024.2.0-beta.10 (diff)
downloadsharkey-16eccad49271b81282cdbd482d29e7a8bb048f4c.tar.gz
sharkey-16eccad49271b81282cdbd482d29e7a8bb048f4c.tar.bz2
sharkey-16eccad49271b81282cdbd482d29e7a8bb048f4c.zip
enhance(frontend): シンタックスハイライトにテーマを適用できるように (#13175)
* enhance(frontend): シンタックスハイライトにテーマを適用できるように * Update Changelog * こっちも * テーマの値がディープマージされるように * 常にテーマ設定に準じるように * テーマ更新時に新しいshikiテーマを読み込むように
Diffstat (limited to 'packages/frontend/src/scripts/theme.ts')
-rw-r--r--packages/frontend/src/scripts/theme.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/packages/frontend/src/scripts/theme.ts b/packages/frontend/src/scripts/theme.ts
index 21ef85fe7a..d3bd9ba4bc 100644
--- a/packages/frontend/src/scripts/theme.ts
+++ b/packages/frontend/src/scripts/theme.ts
@@ -6,6 +6,7 @@
import { ref } from 'vue';
import tinycolor from 'tinycolor2';
import { deepClone } from './clone.js';
+import type { BuiltinTheme } from 'shiki';
import { globalEvents } from '@/events.js';
import lightTheme from '@/themes/_light.json5';
import darkTheme from '@/themes/_dark.json5';
@@ -18,6 +19,13 @@ export type Theme = {
desc?: string;
base?: 'dark' | 'light';
props: Record<string, string>;
+ codeHighlighter?: {
+ base: BuiltinTheme;
+ overrides?: Record<string, any>;
+ } | {
+ base: '_none_';
+ overrides: Record<string, any>;
+ };
};
export const themeProps = Object.keys(lightTheme.props).filter(key => !key.startsWith('X'));
@@ -53,7 +61,7 @@ export const getBuiltinThemesRef = () => {
return builtinThemes;
};
-let timeout = null;
+let timeout: number | null = null;
export function applyTheme(theme: Theme, persist = true) {
if (timeout) window.clearTimeout(timeout);