Replace dark-light with mundy

This commit is contained in:
Héctor Ramón Jiménez 2025-09-08 01:24:22 +02:00
parent efae3860bc
commit 9445f5fcdf
No known key found for this signature in database
GPG key ID: 7CC46565708259A7
4 changed files with 466 additions and 302 deletions

View file

@ -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,
}
});