Implement `Default` for `ThemePreference` (#5702)
Convenient if you store it in an options struct in your app, want to reset it, etc. * ~Closes <https://github.com/emilk/egui/issues/THE_RELEVANT_ISSUE>~ * [x] I have followed the instructions in the PR template
This commit is contained in:
parent
43261a5396
commit
b48c7a164b
|
|
@ -322,7 +322,7 @@ impl Default for Options {
|
|||
Self {
|
||||
dark_style: std::sync::Arc::new(Theme::Dark.default_style()),
|
||||
light_style: std::sync::Arc::new(Theme::Light.default_style()),
|
||||
theme_preference: ThemePreference::System,
|
||||
theme_preference: Default::default(),
|
||||
fallback_theme: Theme::Dark,
|
||||
system_theme: None,
|
||||
zoom_factor: 1.0,
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ impl Theme {
|
|||
}
|
||||
|
||||
/// The user's theme preference.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, Hash)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
|
||||
pub enum ThemePreference {
|
||||
/// Dark mode: light text on a dark background.
|
||||
|
|
@ -76,6 +76,7 @@ pub enum ThemePreference {
|
|||
Light,
|
||||
|
||||
/// Follow the system's theme preference.
|
||||
#[default]
|
||||
System,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue