Clarify activity bar tooltips

This commit is contained in:
2026-07-19 21:46:19 +02:00
parent 23981ce2ae
commit ca7b864261
3 changed files with 29 additions and 14 deletions

View File

@@ -41,6 +41,20 @@ pub fn app_theme() -> Theme {
)
}
/// Opaque tooltip surface that remains legible over editor and sidebar content.
pub fn tooltip_style(_theme: &Theme) -> container::Style {
container::Style {
background: Some(Background::Color(Color::from_rgb(0.20, 0.20, 0.24))),
border: Border {
color: Color::from_rgb(0.35, 0.35, 0.40),
width: 1.0,
radius: 6.0.into(),
},
text_color: Some(Color::WHITE),
..container::Style::default()
}
}
pub fn field_style(_theme: &Theme, status: text_input::Status) -> text_input::Style {
let border_color = match status {
text_input::Status::Focused => FOCUS_COLOR,
@@ -377,4 +391,15 @@ mod tests {
.color
);
}
#[test]
fn tooltip_surface_is_opaque_rounded_and_bordered() {
let style = tooltip_style(&app_theme());
assert!(matches!(
style.background,
Some(Background::Color(color)) if color.a == 1.0
));
assert_eq!(style.border.width, 1.0);
assert_eq!(style.border.radius.top_left, 6.0);
}
}

View File

@@ -5,6 +5,7 @@ use iced::{Background, Border, Color, Element, Length, Theme};
use bds_core::i18n::UiLocale;
use crate::app::Message;
use crate::components::inputs;
use crate::i18n::t;
use crate::state::navigation::SidebarView;
@@ -145,6 +146,7 @@ pub fn view(
tooltip::Position::Right,
)
.gap(4)
.style(inputs::tooltip_style)
.into()
};

View File

@@ -7,6 +7,7 @@ use iced::{Background, Border, Color, Element, Font, Length, Theme};
use bds_core::i18n::UiLocale;
use crate::app::Message;
use crate::components::inputs;
use crate::i18n::t;
use crate::state::tabs::Tab;
@@ -79,19 +80,6 @@ fn close_style(_theme: &Theme, status: button::Status) -> button::Style {
}
}
/// Tooltip style.
fn tooltip_style(_theme: &Theme) -> container::Style {
container::Style {
background: Some(Background::Color(Color::from_rgb(0.20, 0.20, 0.24))),
border: Border {
color: Color::from_rgb(0.35, 0.35, 0.40),
width: 1.0,
radius: 6.0.into(),
},
..container::Style::default()
}
}
/// Truncate chat title per tabs.allium: chat_title_max_length = 18.
fn truncate_chat_title(title: &str) -> String {
if title.chars().count() > CHAT_TITLE_MAX_LEN {
@@ -214,7 +202,7 @@ pub fn view(tabs: &[Tab], active_tab: Option<&str>, locale: UiLocale) -> Element
Position::Bottom,
)
.gap(4)
.style(tooltip_style)
.style(inputs::tooltip_style)
.into();
tip