Remove dark-light dependency (#2929)
* Remove dark-light dependency Since https://github.com/emilk/egui/pull/2750 we now get what we need straight from `winit`. * fix warning * Docstring formatting * fix typo in check.sh
This commit is contained in:
parent
9c9a54ce36
commit
d486c76a9f
|
|
@ -989,23 +989,6 @@ dependencies = [
|
||||||
"winapi",
|
"winapi",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dark-light"
|
|
||||||
version = "1.0.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a62007a65515b3cd88c733dd3464431f05d2ad066999a824259d8edc3cf6f645"
|
|
||||||
dependencies = [
|
|
||||||
"dconf_rs",
|
|
||||||
"detect-desktop-environment",
|
|
||||||
"dirs",
|
|
||||||
"objc",
|
|
||||||
"rust-ini",
|
|
||||||
"web-sys",
|
|
||||||
"winreg",
|
|
||||||
"zbus",
|
|
||||||
"zvariant",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "darling"
|
name = "darling"
|
||||||
version = "0.13.4"
|
version = "0.13.4"
|
||||||
|
|
@ -1047,12 +1030,6 @@ version = "0.2.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5"
|
checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dconf_rs"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7046468a81e6a002061c01e6a7c83139daf91b11c30e66795b13217c2d885c8b"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derivative"
|
name = "derivative"
|
||||||
version = "2.2.0"
|
version = "2.2.0"
|
||||||
|
|
@ -1064,12 +1041,6 @@ dependencies = [
|
||||||
"syn 1.0.107",
|
"syn 1.0.107",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "detect-desktop-environment"
|
|
||||||
version = "0.2.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "21d8ad60dd5b13a4ee6bd8fa2d5d88965c597c67bce32b5fc49c94f55cb50810"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "digest"
|
name = "digest"
|
||||||
version = "0.10.6"
|
version = "0.10.6"
|
||||||
|
|
@ -1136,12 +1107,6 @@ dependencies = [
|
||||||
"libloading",
|
"libloading",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "dlv-list"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "0688c2a7f92e427f44895cd63841bff7b29f8d7a1648b9e7e07a4a365b2e1257"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "document-features"
|
name = "document-features"
|
||||||
version = "0.2.7"
|
version = "0.2.7"
|
||||||
|
|
@ -1211,7 +1176,6 @@ name = "eframe"
|
||||||
version = "0.21.3"
|
version = "0.21.3"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bytemuck",
|
"bytemuck",
|
||||||
"dark-light",
|
|
||||||
"directories-next",
|
"directories-next",
|
||||||
"document-features",
|
"document-features",
|
||||||
"egui",
|
"egui",
|
||||||
|
|
@ -2652,16 +2616,6 @@ dependencies = [
|
||||||
"web-sys",
|
"web-sys",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "ordered-multimap"
|
|
||||||
version = "0.4.3"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "ccd746e37177e1711c20dd619a1620f34f5c8b569c53590a72dedd5344d8924a"
|
|
||||||
dependencies = [
|
|
||||||
"dlv-list",
|
|
||||||
"hashbrown",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ordered-stream"
|
name = "ordered-stream"
|
||||||
version = "0.1.4"
|
version = "0.1.4"
|
||||||
|
|
@ -3111,16 +3065,6 @@ dependencies = [
|
||||||
"xmlparser",
|
"xmlparser",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rust-ini"
|
|
||||||
version = "0.18.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "f6d5f2436026b4f6e79dc829837d467cc7e9a55ee40e750d716713540715a2df"
|
|
||||||
dependencies = [
|
|
||||||
"cfg-if",
|
|
||||||
"ordered-multimap",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustc-demangle"
|
name = "rustc-demangle"
|
||||||
version = "0.1.21"
|
version = "0.1.21"
|
||||||
|
|
@ -4528,15 +4472,6 @@ dependencies = [
|
||||||
"x11-dl",
|
"x11-dl",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "winreg"
|
|
||||||
version = "0.10.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d"
|
|
||||||
dependencies = [
|
|
||||||
"winapi",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "x11-dl"
|
name = "x11-dl"
|
||||||
version = "2.21.0"
|
version = "2.21.0"
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,6 @@ default = ["accesskit", "default_fonts", "glow"]
|
||||||
## Enable platform accessibility API implementations through [AccessKit](https://accesskit.dev/).
|
## Enable platform accessibility API implementations through [AccessKit](https://accesskit.dev/).
|
||||||
accesskit = ["egui/accesskit", "egui-winit/accesskit"]
|
accesskit = ["egui/accesskit", "egui-winit/accesskit"]
|
||||||
|
|
||||||
## Detect dark mode system preference using [`dark-light`](https://docs.rs/dark-light).
|
|
||||||
##
|
|
||||||
## See also [`NativeOptions::follow_system_theme`] and [`NativeOptions::default_theme`].
|
|
||||||
dark-light = ["dep:dark-light"]
|
|
||||||
|
|
||||||
## If set, egui will use `include_bytes!` to bundle some fonts.
|
## If set, egui will use `include_bytes!` to bundle some fonts.
|
||||||
## If you plan on specifying your own fonts you may disable this feature.
|
## If you plan on specifying your own fonts you may disable this feature.
|
||||||
default_fonts = ["egui/default_fonts"]
|
default_fonts = ["egui/default_fonts"]
|
||||||
|
|
@ -107,7 +102,6 @@ raw-window-handle = { version = "0.5.0" }
|
||||||
winit = "0.28.1"
|
winit = "0.28.1"
|
||||||
|
|
||||||
# optional native:
|
# optional native:
|
||||||
dark-light = { version = "1.0", optional = true }
|
|
||||||
directories-next = { version = "2", optional = true }
|
directories-next = { version = "2", optional = true }
|
||||||
egui-wgpu = { version = "0.21.0", path = "../egui-wgpu", optional = true, features = [
|
egui-wgpu = { version = "0.21.0", path = "../egui-wgpu", optional = true, features = [
|
||||||
"winit",
|
"winit",
|
||||||
|
|
|
||||||
|
|
@ -328,18 +328,15 @@ pub struct NativeOptions {
|
||||||
|
|
||||||
/// Try to detect and follow the system preferred setting for dark vs light mode.
|
/// Try to detect and follow the system preferred setting for dark vs light mode.
|
||||||
///
|
///
|
||||||
/// By default, this is `true` on Mac and Windows, but `false` on Linux
|
/// The theme will automatically change when the dark vs light mode preference is changed.
|
||||||
/// due to <https://github.com/frewsxcv/rust-dark-light/issues/17>.
|
|
||||||
///
|
///
|
||||||
/// On Mac and Windows the theme will automatically change when the dark vs light mode preference is changed.
|
/// Does not work on Linux (see <https://github.com/rust-windowing/winit/issues/1549>).
|
||||||
///
|
|
||||||
/// This only works on Linux if the `dark-light` feature is enabled.
|
|
||||||
///
|
///
|
||||||
/// See also [`Self::default_theme`].
|
/// See also [`Self::default_theme`].
|
||||||
pub follow_system_theme: bool,
|
pub follow_system_theme: bool,
|
||||||
|
|
||||||
/// Which theme to use in case [`Self::follow_system_theme`] is `false`
|
/// Which theme to use in case [`Self::follow_system_theme`] is `false`
|
||||||
/// or the `dark-light` feature is disabled.
|
/// or eframe fails to detect the system theme.
|
||||||
///
|
///
|
||||||
/// Default: [`Theme::Dark`].
|
/// Default: [`Theme::Dark`].
|
||||||
pub default_theme: Theme,
|
pub default_theme: Theme,
|
||||||
|
|
@ -454,30 +451,6 @@ impl Default for NativeOptions {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(target_arch = "wasm32"))]
|
|
||||||
impl NativeOptions {
|
|
||||||
/// The theme used by the system.
|
|
||||||
#[cfg(feature = "dark-light")]
|
|
||||||
pub fn system_theme(&self) -> Option<Theme> {
|
|
||||||
if self.follow_system_theme {
|
|
||||||
crate::profile_scope!("dark_light::detect");
|
|
||||||
match dark_light::detect() {
|
|
||||||
dark_light::Mode::Dark => Some(Theme::Dark),
|
|
||||||
dark_light::Mode::Light => Some(Theme::Light),
|
|
||||||
dark_light::Mode::Default => None,
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The theme used by the system.
|
|
||||||
#[cfg(not(feature = "dark-light"))]
|
|
||||||
pub fn system_theme(&self) -> Option<Theme> {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
/// Options when using `eframe` in a web page.
|
/// Options when using `eframe` in a web page.
|
||||||
|
|
|
||||||
|
|
@ -1450,9 +1450,8 @@ fn system_theme(window: &winit::window::Window, options: &NativeOptions) -> Opti
|
||||||
}
|
}
|
||||||
|
|
||||||
// Winit only reads the system theme on macOS and Windows.
|
// Winit only reads the system theme on macOS and Windows.
|
||||||
// On Linux we have to fall back on dark-light (if enabled).
|
|
||||||
// See: https://github.com/rust-windowing/winit/issues/1549
|
// See: https://github.com/rust-windowing/winit/issues/1549
|
||||||
#[cfg(not(any(target_os = "windows", target_os = "macos")))]
|
#[cfg(not(any(target_os = "windows", target_os = "macos")))]
|
||||||
fn system_theme(_window: &winit::window::Window, options: &NativeOptions) -> Option<crate::Theme> {
|
fn system_theme(_window: &winit::window::Window, _options: &NativeOptions) -> Option<crate::Theme> {
|
||||||
options.system_theme()
|
None
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -36,9 +36,7 @@ deny = [
|
||||||
]
|
]
|
||||||
|
|
||||||
skip = [
|
skip = [
|
||||||
{ name = "ahash" }, # old version via dark-light
|
|
||||||
{ name = "arrayvec" }, # old version via tiny-skiaz
|
{ name = "arrayvec" }, # old version via tiny-skiaz
|
||||||
{ name = "hashbrown" }, # old version via dark-light
|
|
||||||
{ name = "nix" }, # old version via winit
|
{ name = "nix" }, # old version via winit
|
||||||
{ name = "redox_syscall" }, # old version via winit
|
{ name = "redox_syscall" }, # old version via winit
|
||||||
{ name = "time" }, # old version pulled in by unmaintianed crate 'chrono'
|
{ name = "time" }, # old version pulled in by unmaintianed crate 'chrono'
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue