From af73c1af06b6165550d32dab9d9c5b980e4bbace Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Mon, 22 May 2023 10:03:02 -0700 Subject: [PATCH] Add seperate scrollbar styling --- crates/editor/src/element.rs | 2 +- crates/theme/src/theme.rs | 8 ++++++++ crates/theme/src/ui.rs | 2 +- styles/src/styleTree/editor.ts | 11 +++++++++++ 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/crates/editor/src/element.rs b/crates/editor/src/element.rs index 57dc3293f6..502975c144 100644 --- a/crates/editor/src/element.rs +++ b/crates/editor/src/element.rs @@ -1052,7 +1052,7 @@ impl EditorElement { ..Default::default() }); - let diff_style = theme::current(cx).editor.diff.clone(); + let diff_style = &theme::current(cx).editor.scrollbar.git; for hunk in layout .position_map .snapshot diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 5a79946589..c589137e73 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -682,6 +682,14 @@ pub struct Scrollbar { pub thumb: ContainerStyle, pub width: f32, pub min_height_factor: f32, + pub git: GitDiffColors +} + +#[derive(Clone, Deserialize, Default)] +pub struct GitDiffColors { + pub inserted: Color, + pub modified: Color, + pub deleted: Color } #[derive(Clone, Deserialize, Default)] diff --git a/crates/theme/src/ui.rs b/crates/theme/src/ui.rs index 1799f37aed..b86bfca8c4 100644 --- a/crates/theme/src/ui.rs +++ b/crates/theme/src/ui.rs @@ -3,7 +3,7 @@ use std::borrow::Cow; use gpui::{ color::Color, elements::{ - ConstrainedBox, Container, ContainerStyle, Empty, Flex, KeystrokeLabel, Label, LabelStyle, + ConstrainedBox, Container, ContainerStyle, Empty, Flex, KeystrokeLabel, Label, MouseEventHandler, ParentElement, Stack, Svg, }, fonts::TextStyle, diff --git a/styles/src/styleTree/editor.ts b/styles/src/styleTree/editor.ts index 2443717e4d..a13ae49c7d 100644 --- a/styles/src/styleTree/editor.ts +++ b/styles/src/styleTree/editor.ts @@ -247,6 +247,17 @@ export default function editor(colorScheme: ColorScheme) { color: borderColor(layer, "variant"), }, }, + git: { + deleted: isLight + ? colorScheme.ramps.red(0.5).hex() + : colorScheme.ramps.red(0.4).hex(), + modified: isLight + ? colorScheme.ramps.yellow(0.3).hex() + : colorScheme.ramps.yellow(0.5).hex(), + inserted: isLight + ? colorScheme.ramps.green(0.4).hex() + : colorScheme.ramps.green(0.5).hex(), + } }, compositionMark: { underline: {