mirror of https://github.com/emilk/egui.git
Branch:
master
accesskit
ahash-compilte-time-rng
antoine/hierachical_dnd_example
axis-labels
better-auto_id
clip_rect
cmc/zero_sized_canvas
code-samples
culling
dancing-strings-experiment
data_aspect
demo-node-graph
dev/mkrueger/key_repeat
dynamic-grid
easymark
eframe-refactor
emilk/android-fix
emilk/debug-fullscreen-failure
emilk/dock
emilk/dock-needs
emilk/double-buffered-wgpu
emilk/eframe_on_close_not_on_wasm
emilk/fix-clamp-value
emilk/fix-docs
emilk/fix-panel-rounding
emilk/fix-tooltip-transparency
emilk/group
emilk/move-up-rerun-sponsor-log
emilk/no-clip-margin
emilk/profile-wgpu
emilk/refactor-web-events
emilk/release-0.27.2
emilk/round-widgets
emilk/tweak-fonts
emilk/zlayer
enable-virtual-scroll-for-heterogeneous-rows
estring
feat-set-minimized
feat-window-actions
fix-request-repaint-thread-safety
fix-scrolling
fix_keypress_event
fornwall/master
gamma-blending
gh-pages
lucas/basic_tests
lucas/egui_cpu
lucas/testing_library
master
multi-fonts-no-copy
multipass
multiviewport-test
ndarilek/master
obellish/master
oklab
pick-weak-text-color
plot
readable-ids
release-0.26-alpha
release-0.26.1
release-0.28.0
release/0.26.2
rgba-default-color
set_decorations
strong-ids
trunk
wasm_graceful_exit
web_handle
wgpu-0.17
wgpu-try-arcanization
wgpu_upgrade
zlayer
0.1.0
0.10.0
0.11.0
0.12.0
0.13.0
0.13.1
0.14.0
0.14.1
0.14.2
0.15.0
0.16.0
0.16.1
0.17.0
0.18.0
0.18.1
0.19.0
0.20.0
0.20.1
0.21.0
0.21.1
0.21.2
0.21.3
0.22.0
0.23.0
0.24.0
0.24.1
0.25.0
0.26.0
0.26.0-alpha.1
0.26.1
0.26.2
0.27.0
0.27.1
0.27.2
0.28.0
0.28.1
0.29.0
0.29.1
0.8.0
0.9.0
0.x.0
latest
${ noResults }
1 Commits (master)
Author | SHA1 | Message | Date |
---|---|---|---|
Tau Gärtli |
b5627c7d40
|
Make Light & Dark Visuals Customizable When Following The System Theme (#4744)
* Closes <https://github.com/emilk/egui/issues/4490> * [x] I have followed the instructions in the PR template --- Unfortunately, this PR contains a bunch of breaking changes because `Context` no longer has one style, but two. I could try to add some of the methods back if that's desired. The most subtle change is probably that `style_mut` mutates both the dark and the light style (which from the usage in egui itself felt like the right choice but might be surprising to users). I decided to deviate a bit from the data structure suggested in the linked issue. Instead of this: ```rust pub theme: Theme, // Dark or Light pub follow_system_theme: bool, // Change [`Self::theme`] based on `RawInput::system_theme`? ``` I decided to add a `ThemePreference` enum and track the current system theme separately. This has a couple of benefits: * The user's theme choice is not magically overwritten on the next frame. * A widget for changing the theme preference only needs to know the `ThemePreference` and not two values. * Persisting the `theme_preference` is fine (as opposed to persisting the `theme` field which may actually be the system theme). The `small_toggle_button` currently only toggles between dark and light (so you can never get back to following the system). I think it's easy to improve on this in a follow-up PR :) I made the function `pub(crate)` for now because it should eventually be a method on `ThemePreference`, not `Theme`. To showcase the new capabilities I added a new example that uses different "accent" colors in dark and light mode: <img src="https://github.com/user-attachments/assets/0bf728c6-2720-47b0-a908-18bd250d15a6" width="250" alt="A screenshot of egui's widget gallery demo in dark mode using a purple accent color instead of the default blue accent"> <img src="https://github.com/user-attachments/assets/e816b380-3e59-4f11-b841-8c20285988d6" width="250" alt="A screenshot of egui's widget gallery demo in light mode using a green accent color instead of the default blue accent"> --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com> |
2 months ago |