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:
n4n5 2025-08-24 16:41:10 +02:00 committed by GitHub
parent 2957fd56a5
commit 0a81372cfd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 1 deletions

View File

@ -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 {