feat: add Flexoki themes for Shiki syntax highlighting

This commit is contained in:
Bohdan Triapitsyn
2025-12-15 00:20:26 +02:00
parent 5bf89ec7d1
commit 2b50f365bd
11 changed files with 1282 additions and 12 deletions
@@ -4,6 +4,8 @@ import type { SupportedLanguages } from '@pierre/diffs';
import { useOptionalThemeSystem } from './useThemeSystem';
import { workerFactory } from '@/lib/diff/workerFactory';
import { ensureFlexokiThemesRegistered } from '@/lib/shiki/registerFlexokiThemes';
import { flexokiThemeNames } from '@/lib/shiki/flexokiThemes';
// Only preload the most common languages - others load on demand
const PRELOAD_LANGS: SupportedLanguages[] = [
@@ -21,10 +23,12 @@ export const DiffWorkerProvider: React.FC<DiffWorkerProviderProps> = ({ children
const themeSystem = useOptionalThemeSystem();
const isDark = themeSystem?.currentTheme?.metadata?.variant === 'dark';
ensureFlexokiThemesRegistered();
const highlighterOptions = useMemo(() => ({
theme: {
dark: 'vitesse-dark' as const,
light: 'vitesse-light' as const,
dark: flexokiThemeNames.dark,
light: flexokiThemeNames.light,
},
themeType: isDark ? ('dark' as const) : ('light' as const),
langs: PRELOAD_LANGS,