mirror of
https://github.com/hanzoai/dev.git
synced 2026-10-25 03:32:32 +00:00
fix(tui): align ansi16 auto drive styling
This commit is contained in:
@@ -207,7 +207,7 @@ impl AutoDriveCardCell {
|
||||
|
||||
fn accent_style(style: &CardStyle) -> Style {
|
||||
if palette_mode() == PaletteMode::Ansi16 {
|
||||
return Style::default().fg(colors::warning());
|
||||
return Style::default().fg(style.accent_fg);
|
||||
}
|
||||
let dim = colors::mix_toward(style.accent_fg, style.text_secondary, 0.85);
|
||||
Style::default().fg(dim)
|
||||
@@ -307,16 +307,8 @@ impl AutoDriveCardCell {
|
||||
format!(" · {}", self.status.label())
|
||||
};
|
||||
let combined = format!("{title_text}{status_text}");
|
||||
let title_style = if palette_mode() == PaletteMode::Ansi16 {
|
||||
Style::default().fg(colors::warning())
|
||||
} else {
|
||||
title_text_style(style)
|
||||
};
|
||||
let status_style = if palette_mode() == PaletteMode::Ansi16 {
|
||||
Style::default().fg(colors::warning())
|
||||
} else {
|
||||
secondary_text_style(style)
|
||||
};
|
||||
let title_style = title_text_style(style);
|
||||
let status_style = secondary_text_style(style);
|
||||
|
||||
if UnicodeWidthStr::width(combined.as_str()) <= body_width {
|
||||
let mut bold_title = title_style;
|
||||
@@ -1081,11 +1073,7 @@ impl AutoDriveCardCell {
|
||||
|
||||
fn bottom_border_row(&self, body_width: usize, style: &CardStyle) -> CardRow {
|
||||
let text = truncate_with_ellipsis(HINT_TEXT, body_width);
|
||||
let hint_style = if palette_mode() == PaletteMode::Ansi16 {
|
||||
Style::default().fg(colors::warning())
|
||||
} else {
|
||||
hint_text_style(style)
|
||||
};
|
||||
let hint_style = hint_text_style(style);
|
||||
let mut segment = CardSegment::new(text, hint_style);
|
||||
segment.inherit_background = true;
|
||||
CardRow::new(
|
||||
|
||||
@@ -106,27 +106,16 @@ pub(crate) fn auto_drive_card_style() -> CardStyle {
|
||||
let mut style = style_from_theme(definition, is_dark);
|
||||
|
||||
if palette_mode() == PaletteMode::Ansi16 {
|
||||
let bg = if is_dark { Color::Blue } else { Color::LightBlue };
|
||||
apply_ansi16_background(&mut style, bg, is_dark);
|
||||
strip_ansi16_background(&mut style);
|
||||
style.title_text = colors::primary();
|
||||
style.accent_fg = colors::primary();
|
||||
style.text_primary = colors::text();
|
||||
style.text_secondary = colors::warning();
|
||||
}
|
||||
|
||||
style
|
||||
}
|
||||
|
||||
fn apply_ansi16_background(style: &mut CardStyle, background: Color, is_dark: bool) {
|
||||
style.gradient = GradientSpec {
|
||||
left: background,
|
||||
right: background,
|
||||
bias: 0.0,
|
||||
};
|
||||
|
||||
let text = if is_dark { Color::White } else { Color::Black };
|
||||
style.accent_fg = text;
|
||||
style.text_primary = text;
|
||||
style.text_secondary = text;
|
||||
style.title_text = text;
|
||||
}
|
||||
|
||||
pub(crate) fn web_search_card_style() -> CardStyle {
|
||||
let is_dark = is_dark_theme_active();
|
||||
let definition = if is_dark {
|
||||
|
||||
Reference in New Issue
Block a user