Skip to content

Commit 7193cb3

Browse files
authored
Merge pull request #125 from Rahix/fix-theme-switch
Fix theme preference not being restored correctly
2 parents 91e6b1b + 78b46c3 commit 7193cb3

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ All notable changes to the `Serial Monitor` crate will be documented in this fil
1010
* Releases are now linked to libssl 3.4.1 on linux (built on Ubuntu 22.04)
1111
* allow to plot only every n-th point (max points is 5000, if dataset is larger, it will reduce it by showing only every
1212
2nd point. if it is larger than 10000 only every 3rd point etc...)
13+
* Fixed the theme preference setting not being properly restored after restarting the application
1314

1415
## 0.3.4
1516

src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use crate::gui::{load_gui_settings, GuiCommand, MyApp, RIGHT_PANEL_WIDTH};
1010
use crate::io::{open_from_csv, save_to_csv, FileOptions};
1111
use crate::serial::{load_serial_settings, serial_devices_thread, serial_thread, Device};
1212
use crossbeam_channel::{select, Receiver, Sender};
13-
use eframe::egui::{vec2, ViewportBuilder, Visuals};
13+
use eframe::egui::{vec2, ViewportBuilder};
1414
use eframe::{egui, icon_data};
1515
use egui_plot::PlotPoint;
1616
use preferences::AppInfo;
@@ -349,7 +349,7 @@ fn main() {
349349
let mut fonts = egui::FontDefinitions::default();
350350
egui_phosphor::add_to_fonts(&mut fonts, egui_phosphor::Variant::Regular);
351351
ctx.egui_ctx.set_fonts(fonts);
352-
ctx.egui_ctx.set_visuals(Visuals::dark());
352+
ctx.egui_ctx.set_theme(gui_settings.theme_preference);
353353
egui_extras::install_image_loaders(&ctx.egui_ctx);
354354

355355
let repaint_signal = ctx.egui_ctx.clone();

src/settings_window.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::gui::GuiSettingsContainer;
22
#[cfg(feature = "self_update")]
33
use crate::update::{check_update, update};
44
use eframe::egui;
5-
use eframe::egui::{Align2, InnerResponse, Vec2, Visuals};
5+
use eframe::egui::{Align2, InnerResponse, Vec2};
66
use egui_theme_switch::ThemeSwitch;
77
#[cfg(feature = "self_update")]
88
use self_update::restart::restart;
@@ -32,7 +32,7 @@ pub fn settings_window(
3232
{
3333
ui.ctx().set_theme(gui_conf.theme_preference);
3434
};
35-
gui_conf.dark_mode = ui.visuals() == &Visuals::dark();
35+
gui_conf.dark_mode = ui.ctx().theme() == egui::Theme::Dark;
3636

3737
ui.end_row();
3838
ui.end_row();

0 commit comments

Comments
 (0)