Merge pull request #2123 from RoboSats/fix-dark-mode-start

Fix dark theme
This commit is contained in:
KoalaSat
2025-07-28 10:11:54 +00:00
committed by GitHub
3 changed files with 10 additions and 1 deletions

View File

@ -67,7 +67,10 @@ class BaseSettings {
}
getMode = (): 'light' | 'dark' => {
return window?.matchMedia('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light';
return (systemClient.getSyncItem?.('settings_mode') as 'light' | 'dark') ||
window?.matchMedia('(prefers-color-scheme: dark)')?.matches
? 'dark'
: 'light';
};
public frontend: 'basic' | 'pro' = 'basic';

View File

@ -33,6 +33,11 @@ class SystemWebClient implements SystemClient {
return value ?? '';
};
public getSyncItem: (key: string) => string | undefined = (key) => {
const value = window.localStorage.getItem(key);
return value ?? '';
};
public setItem: (key: string, value: string) => void = (key, value) => {
window.localStorage.setItem(key, value);
};

View File

@ -5,6 +5,7 @@ import SystemAndroidClient from './SystemAndroidClient';
export interface SystemClient {
loading: boolean;
copyToClipboard: (value: string) => void;
getSyncItem?: (key: string) => string | undefined;
getItem: (key: string) => Promise<string | undefined>;
setItem: (key: string, value: string) => void;
deleteItem: (key: string) => void;