Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bash committed Jul 8, 2024
1 parent ea8a08c commit b684322
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
8 changes: 7 additions & 1 deletion crates/egui/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1103,11 +1103,17 @@ impl Areas {
}
}

#[derive(Clone, Copy, PartialEq, Eq, Hash)]
/// Which theme should egui use?
#[derive(Debug, 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.
Dark,

/// Light mode: dark text on a light background.
Light,

/// Follow the system's theme preference.
System,
}

Expand Down
6 changes: 4 additions & 2 deletions crates/egui/src/widgets/theme_switch/mod.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
use crate::{Painter, Response, ThemePreference, Ui, Widget};
use emath::{Pos2, Rect};
use epaint::Color32;

use crate::{Painter, Response, ThemePreference, Ui, Widget};

mod arc;
mod cogwheel;
mod moon;
mod rotated_rect;
mod sun;

/// A switch control that allows choosing the theme
/// preference (dark, light or follow system).
#[must_use = "You should put this widget in an ui with `ui.add(widget);`"]
#[derive(Debug)]
pub struct ThemeSwitch<'a> {
value: &'a mut ThemePreference,
show_follow_system: bool,
Expand Down

0 comments on commit b684322

Please sign in to comment.