mirror of
https://github.com/usebruno/bruno.git
synced 2026-06-27 22:54:07 +00:00
Set default theme to the user's browser theme (#69)
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user