mirror of
https://github.com/usebruno/bruno.git
synced 2024-12-23 15:19:01 +01:00
Set default theme to the user's browser theme (#69)
This commit is contained in:
parent
544765af3e
commit
b93be5a846
@ -6,7 +6,8 @@ import { ThemeProvider as SCThemeProvider } from 'styled-components';
|
||||
|
||||
export const ThemeContext = createContext();
|
||||
export const ThemeProvider = (props) => {
|
||||
const [storedTheme, setStoredTheme] = useLocalStorage('bruno.theme', 'light');
|
||||
const isBrowserThemeLight = window.matchMedia("(prefers-color-scheme: light)").matches;
|
||||
const [storedTheme, setStoredTheme] = useLocalStorage('bruno.theme', isBrowserThemeLight ? 'light' : 'dark');
|
||||
|
||||
const theme = themes[storedTheme];
|
||||
const themeOptions = Object.keys(themes);
|
||||
|
Loading…
Reference in New Issue
Block a user