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

737
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -175,10 +175,9 @@ bytemuck = { version = "1.0", features = ["derive"] }
bytes = "1.6"
cargo-hot = { package = "cargo-hot-protocol", git = "https://github.com/hecrj/cargo-hot.git", rev = "b8dc518b8640928178a501257e353b73bc06cf47" }
cosmic-text = "0.14"
dark-light = "2.0"
cryoglyph = { git = "https://github.com/iced-rs/cryoglyph.git", rev = "453cedec0d2ec563bd7fa87e84a2319bcebb1ba3" }
futures = { version = "0.3", default-features = false }
glam = "0.25"
cryoglyph = { git = "https://github.com/iced-rs/cryoglyph.git", rev = "453cedec0d2ec563bd7fa87e84a2319bcebb1ba3" }
guillotiere = "0.6"
half = "2.2"
image = { version = "0.25", default-features = false }
@ -188,6 +187,7 @@ lilt = "0.8"
log = "0.4"
lyon = "1.0"
lyon_path = "1.0"
mundy = "0.2"
num-traits = "0.2"
ouroboros = "0.18"
png = "0.17"
@ -196,8 +196,8 @@ qrcode = { version = "0.13", default-features = false }
raw-window-handle = "0.6"
resvg = "0.42"
rustc-hash = "2.0"
serde = "1.0"
semver = "1.0"
serde = "1.0"
sha2 = "0.10"
sipper = "0.1"
smol = "2"

View file

@ -14,7 +14,7 @@ keywords.workspace = true
workspace = true
[features]
auto-detect-theme = ["dep:dark-light"]
auto-detect-theme = ["dep:mundy"]
advanced = []
crisp = []
basic-shaping = []
@ -32,8 +32,8 @@ smol_str.workspace = true
thiserror.workspace = true
web-time.workspace = true
dark-light.workspace = true
dark-light.optional = true
mundy.workspace = true
mundy.optional = true
serde.workspace = true
serde.optional = true

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