Skip to content

Commit f3b7b0f

Browse files
WizardOhio24Stephan Dilly
authored andcommitted
Use theme for push gauge
1 parent c37f229 commit f3b7b0f

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

src/components/push.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use crossterm::event::Event;
2323
use tui::{
2424
backend::Backend,
2525
layout::Rect,
26-
style::{Color, Style},
2726
text::Span,
2827
widgets::{Block, BorderType, Borders, Clear, Gauge},
2928
Frame,
@@ -188,12 +187,7 @@ impl DrawableComponent for PushComponent {
188187
.border_type(BorderType::Thick)
189188
.border_style(self.theme.block(true)),
190189
)
191-
.gauge_style(
192-
//TODO: use theme
193-
Style::default()
194-
.fg(Color::White)
195-
.bg(Color::Black),
196-
)
190+
.gauge_style(self.theme.push_gauge())
197191
.percent(u16::from(progress)),
198192
area,
199193
);

src/ui/style.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ pub struct Theme {
4747
commit_author: Color,
4848
#[serde(with = "Color")]
4949
danger_fg: Color,
50+
#[serde(with = "Color")]
51+
push_gauge_bg: Color,
52+
#[serde(with = "Color")]
53+
push_gauge_fg: Color,
5054
}
5155

5256
impl Theme {
@@ -220,6 +224,12 @@ impl Theme {
220224
)
221225
}
222226

227+
pub fn push_gauge(&self) -> Style {
228+
Style::default()
229+
.fg(self.push_gauge_fg)
230+
.bg(self.push_gauge_bg)
231+
}
232+
223233
fn save(&self) -> Result<()> {
224234
let theme_file = Self::get_theme_file()?;
225235
let mut file = File::create(theme_file)?;
@@ -276,6 +286,8 @@ impl Default for Theme {
276286
commit_time: Color::LightCyan,
277287
commit_author: Color::Green,
278288
danger_fg: Color::Red,
289+
push_gauge_bg: Color::White,
290+
push_gauge_fg: Color::Red,
279291
}
280292
}
281293
}

0 commit comments

Comments
 (0)