mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-23 03:22:19 +03:00
uber-642: use system theme as the default value for application theme (#3534)
Signed-off-by: Alexey Zinoviev <alexey.zinoviev@xored.com>
This commit is contained in:
parent
98055e4dc4
commit
f7d68ee7da
@ -27,10 +27,18 @@ export const setDefaultLanguage = (language: string): void => {
|
||||
}
|
||||
}
|
||||
|
||||
function isSystemThemeDark (): boolean {
|
||||
return window.matchMedia('(prefers-color-scheme: dark)').matches
|
||||
}
|
||||
|
||||
function getDefaultTheme (): string {
|
||||
return isSystemThemeDark() ? 'theme-dark' : 'theme-light'
|
||||
}
|
||||
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export const getCurrentTheme = (): string => localStorage.getItem('theme') ?? 'theme-dark'
|
||||
export const getCurrentTheme = (): string => localStorage.getItem('theme') ?? getDefaultTheme()
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user