Skip to content

Commit a63580d

Browse files
committed
Rename global theme switch functions
1 parent a5831a1 commit a63580d

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

crates/egui/src/widgets/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,14 @@ pub fn stroke_ui(ui: &mut crate::Ui, stroke: &mut epaint::Stroke, text: &str) {
133133
}
134134

135135
/// Show a small button to switch to/from dark/light mode (globally).
136-
pub fn global_dark_light_mode_switch(ui: &mut Ui) {
136+
pub fn global_theme_preference_switch(ui: &mut Ui) {
137137
if let Some(new_theme) = ui.ctx().theme().small_toggle_button(ui) {
138138
ui.ctx().set_theme(new_theme);
139139
}
140140
}
141141

142142
/// Show larger buttons for switching between light and dark mode (globally).
143-
pub fn global_dark_light_mode_buttons(ui: &mut Ui) {
143+
pub fn global_theme_preference_buttons(ui: &mut Ui) {
144144
let mut theme_preference = ui.ctx().options(|opt| opt.theme_preference);
145145
theme_preference.radio_buttons(ui);
146146
ui.ctx().set_theme(theme_preference);

crates/egui_demo_app/src/wrap_app.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -382,7 +382,7 @@ impl WrapApp {
382382
}
383383

384384
fn bar_contents(&mut self, ui: &mut egui::Ui, frame: &mut eframe::Frame, cmd: &mut Command) {
385-
egui::widgets::global_dark_light_mode_switch(ui);
385+
egui::widgets::global_theme_preference_switch(ui);
386386

387387
ui.separator();
388388

crates/egui_extras/src/syntax_highlighting.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ impl CodeTheme {
196196

197197
/// Show UI for changing the color theme.
198198
pub fn ui(&mut self, ui: &mut egui::Ui) {
199-
egui::widgets::global_dark_light_mode_buttons(ui);
199+
egui::widgets::global_theme_preference_buttons(ui);
200200

201201
for theme in SyntectTheme::all() {
202202
if theme.is_dark() == self.dark_mode {
@@ -250,7 +250,7 @@ impl CodeTheme {
250250

251251
ui.vertical(|ui| {
252252
ui.set_width(150.0);
253-
egui::widgets::global_dark_light_mode_buttons(ui);
253+
egui::widgets::global_theme_preference_buttons(ui);
254254

255255
ui.add_space(8.0);
256256
ui.separator();

examples/custom_style/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#![allow(rustdoc::missing_crate_level_docs)] // it's an example
33

44
use eframe::egui::{
5-
self, global_dark_light_mode_buttons, style::Selection, Color32, Stroke, Style,
5+
self, global_theme_preference_buttons, style::Selection, Color32, Stroke, Style,
66
};
77
use egui_demo_lib::{View, WidgetGallery};
88

@@ -61,7 +61,7 @@ impl eframe::App for MyApp {
6161
egui::CentralPanel::default().show(ctx, |ui| {
6262
ui.heading("egui using a customized style");
6363
ui.label("Switch between dark and light mode to see the different styles in action.");
64-
global_dark_light_mode_buttons(ui);
64+
global_theme_preference_buttons(ui);
6565
ui.separator();
6666
self.widget_gallery.ui(ui);
6767
});

examples/custom_window_frame/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl eframe::App for MyApp {
3636
ui.label("This is just the contents of the window.");
3737
ui.horizontal(|ui| {
3838
ui.label("egui theme:");
39-
egui::widgets::global_dark_light_mode_buttons(ui);
39+
egui::widgets::global_theme_preference_buttons(ui);
4040
});
4141
});
4242
}

0 commit comments

Comments
 (0)