Replace dark-light with mundy
This commit is contained in:
parent
efae3860bc
commit
9445f5fcdf
4 changed files with 466 additions and 302 deletions
|
|
@ -170,16 +170,21 @@ impl Default for Theme {
|
|||
fn default() -> Self {
|
||||
#[cfg(feature = "auto-detect-theme")]
|
||||
{
|
||||
use crate::time::Duration;
|
||||
use std::sync::LazyLock;
|
||||
|
||||
static DEFAULT: LazyLock<Theme> = LazyLock::new(|| {
|
||||
match dark_light::detect()
|
||||
.unwrap_or(dark_light::Mode::Unspecified)
|
||||
{
|
||||
dark_light::Mode::Dark => Theme::Dark,
|
||||
dark_light::Mode::Light | dark_light::Mode::Unspecified => {
|
||||
Theme::Light
|
||||
}
|
||||
let color_scheme = mundy::Preferences::once_blocking(
|
||||
mundy::Interest::ColorScheme,
|
||||
Duration::from_millis(100),
|
||||
)
|
||||
.map(|preferences| preferences.color_scheme)
|
||||
.unwrap_or_default();
|
||||
|
||||
match color_scheme {
|
||||
mundy::ColorScheme::Dark => Theme::Dark,
|
||||
mundy::ColorScheme::Light
|
||||
| mundy::ColorScheme::NoPreference => Theme::Light,
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue