Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion crates/egui_extras/src/syntax_highlighting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading