Skip to content

Commit

Permalink
add playback_progress_bar_unfilled component style (#516)
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions authored Jul 29, 2024
1 parent 58a5ace commit 7c10e1e
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ To define application's component styles, the user can specify any of the below
- `playback_album`
- `playback_metadata`
- `playback_progress_bar`
- `playback_progress_bar_unfilled` (Specific to `progress_bar_type` as `Line`)
- `current_playing`
- `page_desc`
- `table_header`
Expand Down
10 changes: 10 additions & 0 deletions spotify_player/src/config/theme.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pub struct ComponentStyle {
pub playback_album: Option<Style>,
pub playback_metadata: Option<Style>,
pub playback_progress_bar: Option<Style>,
pub playback_progress_bar_unfilled: Option<Style>,
pub current_playing: Option<Style>,
pub page_desc: Option<Style>,
pub playlist_desc: Option<Style>,
Expand Down Expand Up @@ -260,6 +261,15 @@ impl Theme {
}
}

pub fn playback_progress_bar_unfilled(&self) -> tui::style::Style {
match &self.component_style.playback_progress_bar_unfilled {
None => Style::default()
.bg(StyleColor::BrightBlack)
.style(&self.palette),
Some(s) => s.style(&self.palette),
}
}

pub fn current_playing(&self) -> tui::style::Style {
match &self.component_style.current_playing {
None => Style::default()
Expand Down
1 change: 1 addition & 0 deletions spotify_player/src/ui/playback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ fn render_playback_progress_bar(
config::ProgressBarType::Line => frame.render_widget(
LineGauge::default()
.filled_style(ui.theme.playback_progress_bar())
.unfilled_style(ui.theme.playback_progress_bar_unfilled())
.ratio(ratio)
.label(Span::styled(
format!(
Expand Down

0 comments on commit 7c10e1e

Please sign in to comment.