Fix color theme when printing (#993)

This commit is contained in:
Nathan Bierema 2022-01-07 19:50:51 -06:00 committed by GitHub
parent 3c0fb90b38
commit 90af902aac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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(
() => () =>