mirror of
https://github.com/frappe/books.git
synced 2024-11-09 15:20:56 +00:00
feat: Added checks for system theme
This commit is contained in:
parent
70e3aacbdc
commit
0eb63e5a1a
@ -32,7 +32,7 @@
|
||||
@row-change="handleChange"
|
||||
/>
|
||||
|
||||
<div class="mt-4 grid grid-cols-2 gap-4 flex items-end">
|
||||
<div class="mt-4 grid grid-cols-2 gap-4 items-end">
|
||||
<Button
|
||||
class="w-full py-5 bg-red-500 dark:bg-red-700"
|
||||
@click="$emit('toggleModal', 'ShiftClose', false)"
|
||||
|
@ -36,7 +36,7 @@
|
||||
@row-change="handleChange"
|
||||
/>
|
||||
|
||||
<div class="mt-4 grid grid-cols-2 gap-4 flex items-end">
|
||||
<div class="mt-4 grid grid-cols-2 gap-4 items-end">
|
||||
<Button
|
||||
class="w-full py-5 bg-red-500 dark:bg-red-700"
|
||||
@click="$router.back()"
|
||||
|
@ -21,8 +21,7 @@ import { setDarkMode } from './utils/theme';
|
||||
}
|
||||
fyo.store.language = language || 'English';
|
||||
|
||||
const darkMode = fyo.config.get('darkMode') as boolean;
|
||||
setDarkMode(darkMode);
|
||||
setDarkMode();
|
||||
|
||||
registerIpcRendererListeners();
|
||||
const { isDevelopment, platform, version } = await ipc.getEnv();
|
||||
|
@ -11,7 +11,14 @@ export async function toggleDarkMode(): Promise<void> {
|
||||
fyo.config.set('darkMode', true);
|
||||
}
|
||||
|
||||
export function setDarkMode(darkMode: boolean): void {
|
||||
export function setDarkMode(): void {
|
||||
var darkMode = fyo.config.get('darkMode');
|
||||
|
||||
/* Fetching system theme */
|
||||
if (darkMode === undefined){
|
||||
darkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
||||
fyo.config.set('darkMode', darkMode);
|
||||
}
|
||||
if (darkMode) {
|
||||
document.documentElement.classList.add('dark');
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user