Skip to content

Add a option to set a highlight of differing lines #230

@tomsons26

Description

@tomsons26

This would make it a lot easier to see what lines differ in a very large diff.
A quick hack i did is this

Image
---
 objdiff-gui/src/views/appearance.rs | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/objdiff-gui/src/views/appearance.rs b/objdiff-gui/src/views/appearance.rs
index e502a9f..3861171 100644
--- a/objdiff-gui/src/views/appearance.rs
+++ b/objdiff-gui/src/views/appearance.rs
@@ -11,6 +11,7 @@ pub struct Appearance {
     pub ui_font: FontId,
     pub code_font: FontId,
     pub diff_colors: Vec<Color32>,
+    pub fill_bg_color: Color32,
     pub theme: egui::Theme,
 
     // Applied by theme
@@ -67,6 +68,7 @@ impl Default for Appearance {
             replace_color: Color32::LIGHT_BLUE,
             insert_color: Color32::GREEN,
             delete_color: Color32::from_rgb(200, 40, 41),
+            fill_bg_color: Color32::DARK_GRAY,
             utc_offset: UtcOffset::UTC,
             fonts: FontState::default(),
             next_ui_font: None,
@@ -103,6 +105,7 @@ impl Appearance {
         match self.theme {
             egui::Theme::Dark => {
                 style.visuals = egui::Visuals::dark();
+                style.visuals.faint_bg_color = self.fill_bg_color;
                 self.text_color = Color32::GRAY;
                 self.emphasized_text_color = Color32::LIGHT_GRAY;
                 self.deemphasized_text_color = Color32::DARK_GRAY;
@@ -114,6 +117,7 @@ impl Appearance {
             }
             egui::Theme::Light => {
                 style.visuals = egui::Visuals::light();
+                style.visuals.faint_bg_color = self.fill_bg_color;
                 self.text_color = Color32::GRAY;
                 self.emphasized_text_color = Color32::DARK_GRAY;
                 self.deemphasized_text_color = Color32::LIGHT_GRAY;
@@ -294,9 +298,22 @@ pub fn appearance_window(ctx: &egui::Context, show: &mut bool, appearance: &mut
             appearance,
         );
         ui.separator();
+        ui.label("Fill color:");
+        ui.color_edit_button_srgba(&mut appearance.fill_bg_color);
+        ui.separator();
         ui.label("Diff colors:");
         if ui.button("Reset").clicked() {
             appearance.diff_colors = DEFAULT_COLOR_ROTATION.to_vec();
+            match appearance.theme {
+                egui::Theme::Dark => {
+                    let visuals = egui::Visuals::dark();
+                    appearance.fill_bg_color = visuals.faint_bg_color;
+                }
+                egui::Theme::Light => {
+                    let visuals = egui::Visuals::light();
+                    appearance.fill_bg_color = visuals.faint_bg_color;
+                }
+            }
         }
         let mut remove_at: Option<usize> = None;
         let num_colors = appearance.diff_colors.len();
-- 
2.46.0.windows.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions