Feat: Use system default color mode, but allow user override

This commit is contained in:
Jaz 2023-05-16 21:36:43 -07:00
parent 404b2f043c
commit da0ed7e002
6 changed files with 59 additions and 35 deletions

View file

@ -189,7 +189,7 @@ export interface ComposerOpts {
}
export class ShellUiModel {
darkMode = false
colorMode = 'system'
minimalShellMode = false
isDrawerOpen = false
isDrawerSwipeDisabled = false
@ -210,20 +210,20 @@ export class ShellUiModel {
serialize(): unknown {
return {
darkMode: this.darkMode,
colorMode: this.colorMode,
}
}
hydrate(v: unknown) {
if (isObj(v)) {
if (hasProp(v, 'darkMode') && typeof v.darkMode === 'boolean') {
this.darkMode = v.darkMode
if (hasProp(v, 'colorMode') && typeof v.colorMode === 'string') {
this.colorMode = v.colorMode
}
}
}
setDarkMode(v: boolean) {
this.darkMode = v
setColorMode(mode: string) {
this.colorMode = mode
}
setMinimalShellMode(v: boolean) {