This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: theme switch hotkey

+20 -1
+20 -1
src/webapp/providers/mantine.tsx
··· 7 7 import { theme } from '@/styles/theme'; 8 8 import { 9 9 MantineProvider as BaseProvider, 10 + useMantineColorScheme, 10 11 v8CssVariablesResolver, 11 12 } from '@mantine/core'; 12 13 import { 13 14 CodeHighlightAdapterProvider, 14 15 createShikiAdapter, 15 16 } from '@mantine/code-highlight'; 16 - 17 + import { useHotkeys } from '@mantine/hooks'; 17 18 import { Notifications } from '@mantine/notifications'; 18 19 19 20 interface Props { ··· 33 34 34 35 const shikiAdapter = createShikiAdapter(loadShiki); 35 36 37 + const schemes = ['light', 'dark', 'auto'] as const; 38 + type ColorScheme = (typeof schemes)[number]; 39 + 40 + function ThemeHotkey() { 41 + const { colorScheme, setColorScheme } = useMantineColorScheme(); 42 + useHotkeys([ 43 + [ 44 + 'ctrl+shift+T', 45 + () => { 46 + const idx = schemes.indexOf(colorScheme as ColorScheme); 47 + setColorScheme(schemes[(idx + 1) % schemes.length]); 48 + }, 49 + ], 50 + ]); 51 + return null; 52 + } 53 + 36 54 export default function MantineProvider(props: Props) { 37 55 return ( 38 56 <BaseProvider ··· 41 59 cssVariablesResolver={v8CssVariablesResolver} 42 60 > 43 61 <CodeHighlightAdapterProvider adapter={shikiAdapter}> 62 + <ThemeHotkey /> 44 63 <Notifications 45 64 position="bottom-right" 46 65 pauseResetOnHover="notification"