mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-25 11:03:57 +03:00
Fix color theme when printing (#993)
This commit is contained in:
parent
3c0fb90b38
commit
90af902aac
|
@ -62,18 +62,12 @@ export const useTheme = ({
|
||||||
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
const mediaQuery = window.matchMedia('(prefers-color-scheme: dark)');
|
||||||
|
|
||||||
const handleChange = ({ matches }: MediaQueryListEvent) => {
|
const handleChange = ({ matches }: MediaQueryListEvent) => {
|
||||||
if (matches && !prefersDarkColorScheme) {
|
setPrefersDarkColorScheme(matches);
|
||||||
setPrefersDarkColorScheme(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!matches && prefersDarkColorScheme) {
|
|
||||||
setPrefersDarkColorScheme(false);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
mediaQuery.addEventListener('change', handleChange);
|
mediaQuery.addEventListener('change', handleChange);
|
||||||
return () => mediaQuery.removeEventListener('change', handleChange);
|
return () => mediaQuery.removeEventListener('change', handleChange);
|
||||||
}, [prefersDarkColorScheme]);
|
}, []);
|
||||||
|
|
||||||
const light = useMemo(
|
const light = useMemo(
|
||||||
() =>
|
() =>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user