made git stuff slightly more themable

This commit is contained in:
Mikayla Maki 2022-09-28 14:58:52 -07:00 committed by Julia
parent b395fbb3f2
commit 9fe6a5e83e
3 changed files with 20 additions and 4 deletions

View file

@ -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::<Settings>().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,
});
}

View file

@ -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<SelectionStyle>,

View file

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