From 552ebc0f290655435d863c87024e36704e6ef451 Mon Sep 17 00:00:00 2001 From: Mikayla Maki Date: Fri, 28 Oct 2022 10:45:45 -0700 Subject: [PATCH] Implemented direct styling for ignored and cut project panel entries --- crates/db/test-db.db | Bin 0 -> 57344 bytes crates/project_panel/src/project_panel.rs | 22 ++++++---- crates/theme/src/theme.rs | 5 ++- styles/src/styleTree/components.ts | 4 +- styles/src/styleTree/projectPanel.ts | 51 ++++++++++++++-------- 5 files changed, 51 insertions(+), 31 deletions(-) create mode 100644 crates/db/test-db.db diff --git a/crates/db/test-db.db b/crates/db/test-db.db new file mode 100644 index 0000000000000000000000000000000000000000..26ea1d32a3b79e8d605aa580ce7597025fc8d7ca GIT binary patch literal 57344 zcmeI)&rjQC7{KwkKtfY~RO-RfB&HXkDTzdfP_@f;SqO$j3!w|{+MX;g@rnnDv)C}Y z8?Yb$(XKo0wsZf7U3b`V_UqX3yEJP>yH2vc5d^=s^ZI>0&*Rs&QuXMImK!+YYj4!I z1M#46x1ec-PlYHH3R?KP68?dVg=hial@ z>=_-S-7tnMce#py2n%^r%No!`Rr<# zuBo&fKDtxXn;WyrA(KRFJJVRY?A|Wvx~^S+APYiPjC?CAMIcwj=^u|WJ$p0fYaCMc zoK5#qr;n4cNQG%U38xfgTFIVp*=`izbi*sp;uPoVo5hk|sc1jOQ=*b0rEyz{TGMZV{NPXS z8KR`b_Y88Wq+~3;)cJA3(suTef0L8L9(0erku~&uH*medO!~@>7X)5kx_8`X$AMfj zF2b?)oL=mI?)q+c2bAP~GTB5K-0{3q#~%C_iAqm}t9$b$y;jq%ZOIzVT*1h3tf<6% zwY8w|s@q~>Wu4e*9qvp5l2JrEyyCv?EzcnGu$e5&+p09e&B+Z{bVHP?e6mo~4{Nh7 zRZ5t?wXL>`m+#NXO1&zjq%vm7886LGQO4^hj8jUP7~)wmaQjYpF7$_S0qz=m^+zpJ zG#+)rdr8wWn+L{`SwDD~rXY=Opq2EsHSKasj_>5$@&j+=B!6!yV@uY?BRg@P$48qQ z&AEMg=BTGadc3V$MZK{$OEWowwVfXaE2J literal 0 HcmV?d00001 diff --git a/crates/project_panel/src/project_panel.rs b/crates/project_panel/src/project_panel.rs index b5d1d0caa369cacf555f1e40f0200645d2879e97..5f1e07aa2166b5b9bf5e412996eba406220cb946 100644 --- a/crates/project_panel/src/project_panel.rs +++ b/crates/project_panel/src/project_panel.rs @@ -1015,15 +1015,19 @@ impl ProjectPanel { let show_editor = details.is_editing && !details.is_processing; MouseEventHandler::::new(entry_id.to_usize(), cx, |state, cx| { let padding = theme.container.padding.left + details.depth as f32 * theme.indent_width; - let mut style = theme.entry.style_for(state, details.is_selected).clone(); - if details.is_ignored { - style.text.color.fade_out(theme.ignored_entry_fade); - style.icon_color.fade_out(theme.ignored_entry_fade); - } - if details.is_cut { - style.text.color.fade_out(theme.cut_entry_fade); - style.icon_color.fade_out(theme.cut_entry_fade); - } + + let entry_style = if details.is_ignored && details.is_cut { + &theme.ignored_and_cut_entry + } else if details.is_ignored { + &theme.ignored_entry + } else if details.is_cut { + &theme.cut_entry + } else { + &theme.entry + }; + + let style = entry_style.style_for(state, details.is_selected).clone(); + let row_container_style = if show_editor { theme.filename_editor.container } else { diff --git a/crates/theme/src/theme.rs b/crates/theme/src/theme.rs index 9cd378cb527f03aa09826c68d5c2c0a42f9670da..c1757cb0223da307a849cf14666f7bde65cfe95d 100644 --- a/crates/theme/src/theme.rs +++ b/crates/theme/src/theme.rs @@ -326,8 +326,9 @@ pub struct ProjectPanel { #[serde(flatten)] pub container: ContainerStyle, pub entry: Interactive, - pub cut_entry_fade: f32, - pub ignored_entry_fade: f32, + pub ignored_entry: Interactive, + pub cut_entry: Interactive, + pub ignored_and_cut_entry: Interactive, pub filename_editor: FieldEditor, pub indent_width: f32, } diff --git a/styles/src/styleTree/components.ts b/styles/src/styleTree/components.ts index 7776c4f14fe272cdc6c0d2ea571be93572194f2c..3244e7e4eab418aa9e365076437da56123dc6aa4 100644 --- a/styles/src/styleTree/components.ts +++ b/styles/src/styleTree/components.ts @@ -89,6 +89,7 @@ interface TextProperties { size?: keyof typeof fontSizes; weight?: FontWeight; underline?: boolean; + color?: string; } export function text( @@ -132,11 +133,12 @@ export function text( } let size = fontSizes[properties?.size || "sm"]; + let color = properties?.color || style.foreground; return { family: fontFamilies[fontFamily], - color: style.foreground, ...properties, + color, size, }; } diff --git a/styles/src/styleTree/projectPanel.ts b/styles/src/styleTree/projectPanel.ts index 9b906c893f8321c223664ed0087cf9c20957fd5b..49c7f048c4c8a67b9ad5782ee7a1b8d48734284c 100644 --- a/styles/src/styleTree/projectPanel.ts +++ b/styles/src/styleTree/projectPanel.ts @@ -3,30 +3,43 @@ import { background, foreground, text } from "./components"; export default function projectPanel(colorScheme: ColorScheme) { let layer = colorScheme.middle; + + let entry = { + height: 24, + iconColor: foreground(layer, "variant"), + iconSize: 8, + iconSpacing: 8, + text: text(layer, "mono", "variant", { size: "sm" }), + hover: { + background: background(layer, "variant", "hovered"), + }, + active: { + background: background(layer, "active"), + text: text(layer, "mono", "active", { size: "sm" }), + }, + activeHover: { + background: background(layer, "active"), + text: text(layer, "mono", "active", { size: "sm" }), + }, + }; + return { background: background(layer), padding: { left: 12, right: 12, top: 6, bottom: 6 }, indentWidth: 8, - entry: { - height: 24, - iconColor: foreground(layer, "variant"), - iconSize: 8, - iconSpacing: 8, - text: text(layer, "mono", "variant", { size: "sm" }), - hover: { - background: background(layer, "variant", "hovered"), - }, - active: { - background: background(layer, "active"), - text: text(layer, "mono", "active", { size: "sm" }), - }, - activeHover: { - background: background(layer, "active"), - text: text(layer, "mono", "active", { size: "sm" }), - }, + entry, + ignoredEntry: { + ...entry, + text: text(layer, "mono", "variant", { color: "#ff00cc" }), + }, + cutEntry: { + ...entry, + text: text(layer, "mono", "variant", { color: "#ff00cc" }), + }, + ignoredAndCutEntry: { + ...entry, + text: text(layer, "mono", "variant", { color: "#ffb700" }), }, - cutEntryFade: 0.4, - ignoredEntryFade: 0.6, filenameEditor: { background: background(layer, "on"), text: text(layer, "mono", "on", { size: "sm" }),