mirror of
https://github.com/lone-cloud/gerbil
synced 2026-06-03 19:54:44 -07:00
ensure that the system theme is followed if it's changed during runtime
This commit is contained in:
parent
8c02a97129
commit
4ac392f429
2 changed files with 11 additions and 1 deletions
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "gerbil",
|
||||
"productName": "Gerbil",
|
||||
"version": "1.6.5",
|
||||
"version": "1.6.6",
|
||||
"description": "Run Large Language Models locally",
|
||||
"main": "out/main/index.js",
|
||||
"homepage": "./",
|
||||
|
|
|
|||
|
|
@ -25,6 +25,16 @@ const resolveColorScheme = (raw: MantineColorScheme): ResolvedColorScheme => {
|
|||
return raw;
|
||||
};
|
||||
|
||||
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||
mediaQuery.addEventListener('change', () => {
|
||||
const { rawColorScheme } = usePreferencesStore.getState();
|
||||
if (rawColorScheme === 'auto') {
|
||||
usePreferencesStore.setState({
|
||||
resolvedColorScheme: resolveColorScheme('auto'),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
export const usePreferencesStore = create<PreferencesStore>((set) => ({
|
||||
frontendPreference: 'koboldcpp',
|
||||
rawColorScheme: 'auto',
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue