From 9fe6a5e83e1c6a8cdfbe3669a25576fed0a4dbbe Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Wed, 28 Sep 2022 14:58:52 -0700 Subject: [PATCH] made git stuff slightly more themable --- crates/editor/src/element.rs | 18 ++++++++++++++---- crates/theme/src/theme.rs | 3 +++ styles/src/styleTree/editor.ts | 3 +++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index b8731f8707..57ee919288 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -545,12 +545,22 @@ impl EditorElement { } } - let (inserted_color, modified_color, deleted_color) = { + let ( + inserted_color, + modified_color, + deleted_color, + width_multiplier, + corner_radius, + removed_width_mult, + ) = { let editor = &cx.global::().theme.editor; ( editor.diff_background_inserted, editor.diff_background_modified, editor.diff_background_deleted, + editor.diff_indicator_width_multiplier, + editor.diff_indicator_corner_radius, + editor.removed_diff_width_multiplier, ) }; @@ -567,7 +577,7 @@ impl EditorElement { let start_y = row as f32 * line_height + offset - scroll_top; let end_y = start_y + line_height; - let width = 0.275 * line_height; + let width = removed_width_mult * line_height; let highlight_origin = bounds.origin() + vec2f(-width, start_y); let highlight_size = vec2f(width * 2., end_y - start_y); let highlight_bounds = RectF::new(highlight_origin, highlight_size); @@ -589,7 +599,7 @@ impl EditorElement { let start_y = start_row as f32 * line_height - scroll_top; let end_y = end_row as f32 * line_height - scroll_top; - let width = 0.16 * line_height; + let width = width_multiplier * line_height; let highlight_origin = bounds.origin() + vec2f(-width, start_y); let highlight_size = vec2f(width * 2., end_y - start_y); let highlight_bounds = RectF::new(highlight_origin, highlight_size); @@ -598,7 +608,7 @@ impl EditorElement { bounds: highlight_bounds, background: Some(color), border: Border::new(0., Color::transparent_black()), - corner_radius: 0.05 * line_height, + corner_radius: corner_radius * line_height, }); } diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 1fd586efee..0d0c94ea8d 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -491,6 +491,9 @@ pub struct Editor { pub diff_background_deleted: Color, pub diff_background_inserted: Color, pub diff_background_modified: Color, + pub removed_diff_width_multiplier: f32, + pub diff_indicator_width_multiplier: f32, + pub diff_indicator_corner_radius: f32, pub line_number: Color, pub line_number_active: Color, pub guest_selections: Vec, diff --git a/styles/src/styleTree/editor.ts b/styles/src/styleTree/editor.ts index bd01c3b845..6e52c620ee 100644 --- a/styles/src/styleTree/editor.ts +++ b/styles/src/styleTree/editor.ts @@ -63,6 +63,9 @@ export default function editor(theme: Theme) { diffBackgroundDeleted: theme.iconColor.error, diffBackgroundInserted: theme.iconColor.ok, diffBackgroundModified: theme.iconColor.warning, + removedDiffWidthMultiplier: 0.275, + diffIndicatorWidthMultiplier: 0.16, + diffIndicatorCornerRadius: 0.05, documentHighlightReadBackground: theme.editor.highlight.occurrence, documentHighlightWriteBackground: theme.editor.highlight.activeOccurrence, errorColor: theme.textColor.error,