mirror of
https://github.com/emilk/egui.git
synced 2026-06-26 22:53:14 -04:00
Add theme selection for code editor (#7375)
Change the theme selection of the code editor Before - was showing the window theme selector After - is showing the code editor theme selector <img width="327" height="262" alt="image" src="https://github.com/user-attachments/assets/50776218-26cc-4f11-9b91-6f902c022394" /> * [x] I have followed the instructions in the PR template --------- Co-authored-by: Emil Ernerfeldt <emil.ernerfeldt@gmail.com>
This commit is contained in:
@@ -333,9 +333,19 @@ impl CodeTheme {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn is_dark(&self) -> bool {
|
||||
self.dark_mode
|
||||
}
|
||||
|
||||
/// Show UI for changing the color theme.
|
||||
pub fn ui(&mut self, ui: &mut egui::Ui) {
|
||||
egui::widgets::global_theme_preference_buttons(ui);
|
||||
ui.horizontal(|ui| {
|
||||
ui.selectable_value(&mut self.dark_mode, true, "🌙 Dark theme")
|
||||
.on_hover_text("Use the dark mode theme");
|
||||
|
||||
ui.selectable_value(&mut self.dark_mode, false, "☀ Light theme")
|
||||
.on_hover_text("Use the light mode theme");
|
||||
});
|
||||
|
||||
for theme in SyntectTheme::all() {
|
||||
if theme.is_dark() == self.dark_mode {
|
||||
|
||||
Reference in New Issue
Block a user