Fixed status icon background
This commit is contained in:
+2
-1
@@ -152,7 +152,8 @@ fn draw_tile_meta(
|
||||
availability: Option<Availability>,
|
||||
selected: bool,
|
||||
) {
|
||||
let marker = availability.map(|availability| availability_marker(availability, selected));
|
||||
let selected_style = selected.then(|| theme::tab_active_for(state));
|
||||
let marker = availability.map(|availability| availability_marker(availability, selected_style));
|
||||
let marker_width = marker
|
||||
.map(|(label, _)| UnicodeWidthStr::width(label) as u16)
|
||||
.unwrap_or(0)
|
||||
|
||||
+18
-7
@@ -19,25 +19,36 @@ use crate::library::models::Availability;
|
||||
|
||||
pub(crate) fn availability_marker(
|
||||
availability: Availability,
|
||||
selected: bool,
|
||||
selected_style: Option<Style>,
|
||||
) -> (&'static str, Style) {
|
||||
let (label, style) = match availability {
|
||||
Availability::Local => ("●", Style::new().fg(Color::Green)),
|
||||
Availability::Mixed => ("◐", Style::new().fg(Color::Yellow)),
|
||||
Availability::Remote => ("⇅", theme::accent()),
|
||||
};
|
||||
if selected {
|
||||
(label, theme::tab_active())
|
||||
} else {
|
||||
(label, style)
|
||||
}
|
||||
(label, selected_style.unwrap_or(style))
|
||||
}
|
||||
|
||||
pub(crate) fn availability_prefix(availability: Availability) -> Span<'static> {
|
||||
let (label, style) = availability_marker(availability, false);
|
||||
let (label, style) = availability_marker(availability, None);
|
||||
Span::styled(format!("{label} "), style)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn selected_availability_marker_uses_the_supplied_mode_style() {
|
||||
let client_style = Style::new().fg(Color::Black).bg(Color::Yellow);
|
||||
|
||||
let (label, style) = availability_marker(Availability::Local, Some(client_style));
|
||||
|
||||
assert_eq!(label, "●");
|
||||
assert_eq!(style, client_style);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn draw(frame: &mut Frame, state: &AppState, keymap: &Keymap) {
|
||||
if state.visualizer.active {
|
||||
crate::visualizer::draw(frame, state);
|
||||
|
||||
@@ -18,13 +18,6 @@ pub fn dim() -> Style {
|
||||
Style::new().fg(DIM)
|
||||
}
|
||||
|
||||
pub fn tab_active() -> Style {
|
||||
Style::new()
|
||||
.fg(Color::Black)
|
||||
.bg(ACCENT)
|
||||
.add_modifier(Modifier::BOLD)
|
||||
}
|
||||
|
||||
pub fn tab_active_for(state: &AppState) -> Style {
|
||||
Style::new()
|
||||
.fg(Color::Black)
|
||||
|
||||
Reference in New Issue
Block a user