1
0
mirror of https://github.com/emilk/egui.git synced 2026-09-01 14:20:04 -04:00

eframe: Don't follow system theme by default (#1941)

I have gone back and forth on this a bit, but I think the arguments
AGAINST following the system theme are many:

* `dark-light` is a big dependency with problems on Linux.
* Many people prefer the dark mode and ask how to set it as the default
  (even though they are using light mode in their OS).
* A developer may be surprised when the app changes theme when
  they run it on another computer.

So, the path of least surprise is to make this an opt-in feature
with dark mode as the default mode.

On native, you add the `dark-light` feature to enable it.
On web, you set `WebOptions::follow_system_theme`.
This commit is contained in:
Emil Ernerfeldt
2022-08-20 11:11:07 +02:00
committed by GitHub
parent 40e440b2f7
commit f4cc1c5465
3 changed files with 8 additions and 8 deletions

View File

@@ -259,7 +259,7 @@ pub struct NativeOptions {
/// What rendering backend to use.
pub renderer: Renderer,
/// If the `dark-light` feature is enabled:
/// Only used if the `dark-light` feature is enabled:
///
/// Try to detect and follow the system preferred setting for dark vs light mode.
///
@@ -272,7 +272,7 @@ pub struct NativeOptions {
/// Which theme to use in case [`Self::follow_system_theme`] is `false`
/// or the `dark-light` feature is disabled.
///
/// Default: `Theme::Dark`.
/// Default: [`Theme::Dark`].
pub default_theme: Theme,
/// This controls what happens when you close the main eframe window.
@@ -351,7 +351,7 @@ pub struct WebOptions {
///
/// See also [`Self::default_theme`].
///
/// Default: `true`.
/// Default: `false`.
pub follow_system_theme: bool,
/// Which theme to use in case [`Self::follow_system_theme`] is `false`