follow system theme

This commit is contained in:
tk103331
2023-01-04 16:55:34 +08:00
parent f26dace129
commit 845229d629
4 changed files with 28 additions and 4 deletions

View File

@@ -177,7 +177,17 @@ impl ChatConfJson {
pub fn theme() -> Option<Theme> {
let conf = ChatConfJson::get_chat_conf();
if conf.theme == "Dark" {
if conf.theme == "System" {
let mode = dark_light::detect();
return match mode {
// Dark mode
dark_light::Mode::Dark => Some(Theme::Dark),
// Light mode
dark_light::Mode::Light => Some(Theme::Light),
// Unspecified
dark_light::Mode::Default => Some(Theme::Light),
}
} if conf.theme == "Dark" {
Some(Theme::Dark)
} else {
Some(Theme::Light)