mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-22 09:36:43 +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 handleChange = ({ matches }: MediaQueryListEvent) => {
|
||||
if (matches && !prefersDarkColorScheme) {
|
||||
setPrefersDarkColorScheme(true);
|
||||
}
|
||||
|
||||
if (!matches && prefersDarkColorScheme) {
|
||||
setPrefersDarkColorScheme(false);
|
||||
}
|
||||
setPrefersDarkColorScheme(matches);
|
||||
};
|
||||
|
||||
mediaQuery.addEventListener('change', handleChange);
|
||||
return () => mediaQuery.removeEventListener('change', handleChange);
|
||||
}, [prefersDarkColorScheme]);
|
||||
}, []);
|
||||
|
||||
const light = useMemo(
|
||||
() =>
|
||||
|
|
Loading…
Reference in New Issue
Block a user