mirror of
https://github.com/emilk/egui.git
synced 2026-08-29 04:40:03 -04:00
Follow the System Theme in egui (#4860)
* Some initial progress towards #4490 This PR just moves `Theme` and the "follow system theme" settings to egui and adds `RawInput.system_theme`. A follow-up PR can then introduce the two separate `dark_mode_style` and `light_mode_style` fields on `Options`. <!-- Please read the "Making a PR" section of [`CONTRIBUTING.md`](https://github.com/emilk/egui/blob/master/CONTRIBUTING.md) before opening a Pull Request! * If applicable, add a screenshot or gif. * If it is a non-trivial addition, consider adding a demo for it to `egui_demo_lib`, or a new example. * Do NOT open PR:s from your `master` branch, as that makes it hard for maintainers to test and add commits to your PR. * Remember to run `cargo fmt` and `cargo clippy`. * Open the PR as a draft until you have self-reviewed it and run `./scripts/check.sh`. * When you have addressed a PR comment, mark it as resolved. Please be patient! I will review your PR, but my time is limited! --> * [x] I have followed the instructions in the PR template ### Breaking changes The options `follow_system_theme` and `default_theme` has been moved from `eframe` into `egui::Options`, settable with `ctx.options_mut` --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -192,7 +192,8 @@ impl winit::application::ApplicationHandler<UserEvent> for GlowApp {
|
||||
let gl = std::sync::Arc::new(gl);
|
||||
gl_window.window().set_visible(true);
|
||||
|
||||
let egui_glow = egui_glow::EguiGlow::new(event_loop, gl.clone(), None, None, true);
|
||||
let egui_glow =
|
||||
egui_glow::EguiGlow::new(event_loop, &gl_window.window, gl.clone(), None, None, true);
|
||||
|
||||
let event_loop_proxy = egui::mutex::Mutex::new(self.proxy.clone());
|
||||
egui_glow
|
||||
|
||||
@@ -24,6 +24,7 @@ impl EguiGlow {
|
||||
/// For automatic shader version detection set `shader_version` to `None`.
|
||||
pub fn new(
|
||||
event_loop: &winit::event_loop::ActiveEventLoop,
|
||||
window: &winit::window::Window,
|
||||
gl: std::sync::Arc<glow::Context>,
|
||||
shader_version: Option<ShaderVersion>,
|
||||
native_pixels_per_point: Option<f32>,
|
||||
@@ -42,6 +43,7 @@ impl EguiGlow {
|
||||
ViewportId::ROOT,
|
||||
event_loop,
|
||||
native_pixels_per_point,
|
||||
window.theme(),
|
||||
Some(painter.max_texture_side()),
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user