mirror of
https://github.com/RoboSats/robosats.git
synced 2025-09-13 00:56:22 +00:00
Fix dark theme
This commit is contained in:
@ -67,7 +67,10 @@ class BaseSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getMode = (): 'light' | 'dark' => {
|
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';
|
public frontend: 'basic' | 'pro' = 'basic';
|
||||||
|
|||||||
@ -33,6 +33,12 @@ class SystemWebClient implements SystemClient {
|
|||||||
return value ?? '';
|
return value ?? '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Local storage
|
||||||
|
public getSyncItem: (key: string) => string | undefined = (key) => {
|
||||||
|
const value = window.localStorage.getItem(key);
|
||||||
|
return value ?? '';
|
||||||
|
};
|
||||||
|
|
||||||
public setItem: (key: string, value: string) => void = (key, value) => {
|
public setItem: (key: string, value: string) => void = (key, value) => {
|
||||||
window.localStorage.setItem(key, value);
|
window.localStorage.setItem(key, value);
|
||||||
};
|
};
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import SystemAndroidClient from './SystemAndroidClient';
|
|||||||
export interface SystemClient {
|
export interface SystemClient {
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
copyToClipboard: (value: string) => void;
|
copyToClipboard: (value: string) => void;
|
||||||
|
getSyncItem?: (key: string) => string | undefined;
|
||||||
getItem: (key: string) => Promise<string | undefined>;
|
getItem: (key: string) => Promise<string | undefined>;
|
||||||
setItem: (key: string, value: string) => void;
|
setItem: (key: string, value: string) => void;
|
||||||
deleteItem: (key: string) => void;
|
deleteItem: (key: string) => void;
|
||||||
|
|||||||
@ -63,6 +63,14 @@
|
|||||||
color: #c0392b;
|
color: #c0392b;
|
||||||
text-decoration: underline;
|
text-decoration: underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Dark mode styles based on system preference */
|
||||||
|
@media (prefers-color-scheme: dark) {
|
||||||
|
body {
|
||||||
|
background-color: black;
|
||||||
|
color: #f0f0f0;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
@ -116,4 +124,4 @@
|
|||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
Reference in New Issue
Block a user