This commit is contained in:
Nate Butler 2023-11-13 17:38:44 -05:00
parent 97d6e7f2f5
commit dd434588ee
3 changed files with 19 additions and 15 deletions

View file

@ -30,6 +30,7 @@ use std::{
}; };
use text::Selection; use text::Selection;
use theme::{ActiveTheme, Theme}; use theme::{ActiveTheme, Theme};
use ui::{Label, LabelColor};
use util::{paths::PathExt, ResultExt, TryFutureExt}; use util::{paths::PathExt, ResultExt, TryFutureExt};
use workspace::item::{BreadcrumbText, FollowEvent, FollowableEvents, FollowableItemHandle}; use workspace::item::{BreadcrumbText, FollowEvent, FollowableEvents, FollowableItemHandle};
use workspace::{ use workspace::{
@ -595,16 +596,19 @@ impl Item for Editor {
.flex_row() .flex_row()
.items_center() .items_center()
.gap_2() .gap_2()
.child(self.title(cx).to_string()) .child(Label::new(self.title(cx).to_string()))
.children(detail.and_then(|detail| { .children(detail.and_then(|detail| {
let path = path_for_buffer(&self.buffer, detail, false, cx)?; let path = path_for_buffer(&self.buffer, detail, false, cx)?;
let description = path.to_string_lossy(); let description = path.to_string_lossy();
Some( Some(
div() div().child(
.text_color(theme.colors().text_muted) Label::new(util::truncate_and_trailoff(
.text_xs() &description,
.child(util::truncate_and_trailoff(&description, MAX_TAB_TITLE_LEN)), MAX_TAB_TITLE_LEN,
))
.color(LabelColor::Muted),
),
) )
})), })),
) )

View file

@ -20,6 +20,7 @@ pub fn one_family() -> ThemeFamily {
pub(crate) fn one_dark() -> Theme { pub(crate) fn one_dark() -> Theme {
let bg = hsla(215. / 360., 12. / 100., 15. / 100., 1.); let bg = hsla(215. / 360., 12. / 100., 15. / 100., 1.);
let editor = hsla(220. / 360., 12. / 100., 18. / 100., 1.); let editor = hsla(220. / 360., 12. / 100., 18. / 100., 1.);
let elevated_surface = hsla(220. / 360., 12. / 100., 18. / 100., 1.);
let blue = hsla(207.8 / 360., 81. / 100., 66. / 100., 1.0); let blue = hsla(207.8 / 360., 81. / 100., 66. / 100., 1.0);
let gray = hsla(218.8 / 360., 10. / 100., 40. / 100., 1.0); let gray = hsla(218.8 / 360., 10. / 100., 40. / 100., 1.0);
@ -43,10 +44,10 @@ pub(crate) fn one_dark() -> Theme {
border_selected: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0), border_selected: hsla(222.6 / 360., 77.5 / 100., 65.1 / 100., 1.0),
border_transparent: SystemColors::default().transparent, border_transparent: SystemColors::default().transparent,
border_disabled: hsla(222.0 / 360., 11.6 / 100., 33.7 / 100., 1.0), border_disabled: hsla(222.0 / 360., 11.6 / 100., 33.7 / 100., 1.0),
elevated_surface_background: bg, elevated_surface_background: elevated_surface,
surface_background: bg, surface_background: bg,
background: bg, background: bg,
element_background: hsla(222.9 / 360., 11.1 / 100., 24.7 / 100., 1.0), element_background: elevated_surface,
element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0), element_hover: hsla(225.0 / 360., 11.8 / 100., 26.7 / 100., 1.0),
element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0), element_active: hsla(220.0 / 360., 11.8 / 100., 20.0 / 100., 1.0),
element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0), element_selected: hsla(224.0 / 360., 11.3 / 100., 26.1 / 100., 1.0),

View file

@ -1,6 +1,8 @@
use gpui::{div, Div, ParentElement, Render, SharedString, Styled, ViewContext}; use gpui::{div, Div, ParentElement, Render, SharedString, Styled, ViewContext};
use theme2::ActiveTheme; use theme2::ActiveTheme;
use crate::StyledExt;
#[derive(Clone, Debug)] #[derive(Clone, Debug)]
pub struct TextTooltip { pub struct TextTooltip {
title: SharedString, title: SharedString,
@ -16,16 +18,13 @@ impl Render for TextTooltip {
type Element = Div<Self>; type Element = Div<Self>;
fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element { fn render(&mut self, cx: &mut ViewContext<Self>) -> Self::Element {
let theme = cx.theme();
div() div()
.bg(theme.colors().background) .elevation_2(cx)
.rounded_lg()
.border()
.font("Zed Sans") .font("Zed Sans")
.border_color(theme.colors().border) .text_ui()
.text_color(theme.colors().text) .text_color(cx.theme().colors().text)
.pl_2() .py_1()
.pr_2() .px_2()
.child(self.title.clone()) .child(self.title.clone())
} }
} }