mirror of
https://github.com/emilk/egui.git
synced 2026-08-30 05:10:03 -04:00
Use dark-light on Mac and Windows (#1726)
* Use dark-light on Mac and Windows dark-light has a nasty problem on Linux: https://github.com/frewsxcv/rust-dark-light/issues/17 So we made dark-light opt-in in https://github.com/emilk/egui/pull/1437 This PR makes dark-light a default dependency again, but only use it on Max and Windows. This is controlled with the new NativeOptions::follow_system_theme. If this isn't enabled, then NativeOptions::default_theme is used. * Add eframe::WebOptions
This commit is contained in:
@@ -66,15 +66,19 @@ pub fn run_glow(
|
||||
let mut painter = egui_glow::Painter::new(gl.clone(), None, "")
|
||||
.unwrap_or_else(|error| panic!("some OpenGL error occurred {}\n", error));
|
||||
|
||||
let system_theme = native_options.system_theme();
|
||||
let mut integration = epi_integration::EpiIntegration::new(
|
||||
&event_loop,
|
||||
painter.max_texture_side(),
|
||||
gl_window.window(),
|
||||
system_theme,
|
||||
storage,
|
||||
Some(gl.clone()),
|
||||
#[cfg(feature = "wgpu")]
|
||||
None,
|
||||
);
|
||||
let theme = system_theme.unwrap_or(native_options.default_theme);
|
||||
integration.egui_ctx.set_visuals(theme.egui_visuals());
|
||||
|
||||
{
|
||||
let event_loop_proxy = egui::mutex::Mutex::new(event_loop.create_proxy());
|
||||
@@ -248,15 +252,19 @@ pub fn run_wgpu(
|
||||
|
||||
let render_state = painter.get_render_state().expect("Uninitialized");
|
||||
|
||||
let system_theme = native_options.system_theme();
|
||||
let mut integration = epi_integration::EpiIntegration::new(
|
||||
&event_loop,
|
||||
painter.max_texture_side().unwrap_or(2048),
|
||||
&window,
|
||||
system_theme,
|
||||
storage,
|
||||
#[cfg(feature = "glow")]
|
||||
None,
|
||||
Some(render_state.clone()),
|
||||
);
|
||||
let theme = system_theme.unwrap_or(native_options.default_theme);
|
||||
integration.egui_ctx.set_visuals(theme.egui_visuals());
|
||||
|
||||
{
|
||||
let event_loop_proxy = egui::mutex::Mutex::new(event_loop.create_proxy());
|
||||
|
||||
Reference in New Issue
Block a user