mirror of
https://github.com/umami-software/umami.git
synced 2026-02-12 00:27:11 +01:00
Check user theme preference, closes #555.
This commit is contained in:
parent
92705815ed
commit
041c7737e8
1 changed files with 2 additions and 1 deletions
|
|
@ -5,7 +5,8 @@ import { THEME_CONFIG } from 'lib/constants';
|
||||||
import { useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
|
|
||||||
export default function useTheme() {
|
export default function useTheme() {
|
||||||
const theme = useSelector(state => state.app.theme || getItem(THEME_CONFIG) || 'light');
|
const defaultTheme = window?.matchMedia('prefers-color-scheme: dark')?.matches ? 'dark' : 'light';
|
||||||
|
const theme = useSelector(state => state.app.theme || getItem(THEME_CONFIG) || defaultTheme);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
function saveTheme(value) {
|
function saveTheme(value) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue