Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade dark-light to v2 #2724

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bitflags = "2.0"
bytemuck = { version = "1.0", features = ["derive"] }
bytes = "1.6"
cosmic-text = "0.12"
dark-light = "1.0"
dark-light = "2.0"
futures = "0.3"
glam = "0.25"
glyphon = { git = "https://github.com/hecrj/glyphon.git", rev = "09712a70df7431e9a3b1ac1bbd4fb634096cb3b4" }
Expand Down
13 changes: 6 additions & 7 deletions core/src/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,12 @@ impl Default for Theme {
{
use std::sync::LazyLock;

static DEFAULT: LazyLock<Theme> =
LazyLock::new(|| match dark_light::detect() {
dark_light::Mode::Dark => Theme::Dark,
dark_light::Mode::Light | dark_light::Mode::Default => {
Theme::Light
}
});
static DEFAULT: LazyLock<Theme> = LazyLock::new(|| match dark_light::detect() {
Ok(dark_light::Mode::Dark) => Theme::Dark,
Ok(dark_light::Mode::Light) | Ok(dark_light::Mode::Unspecified) | Err(_) => {
Theme::Light
Comment on lines +173 to +174
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Ok(dark_light::Mode::Light) | Ok(dark_light::Mode::Unspecified) | Err(_) => {
Theme::Light
_ => Theme::Light,

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I would've made this change before even opening the PR, but I decided to preserve the verbosity of the original just-in-case there's a reason for the verbosity

}
});

DEFAULT.clone()
}
Expand Down