mirror of
https://github.com/gitui-org/gitui
synced 2026-05-24 01:18:21 +00:00
Use theme for push gauge
This commit is contained in:
parent
c37f229070
commit
f3b7b0ffac
2 changed files with 13 additions and 7 deletions
|
|
@ -23,7 +23,6 @@ use crossterm::event::Event;
|
||||||
use tui::{
|
use tui::{
|
||||||
backend::Backend,
|
backend::Backend,
|
||||||
layout::Rect,
|
layout::Rect,
|
||||||
style::{Color, Style},
|
|
||||||
text::Span,
|
text::Span,
|
||||||
widgets::{Block, BorderType, Borders, Clear, Gauge},
|
widgets::{Block, BorderType, Borders, Clear, Gauge},
|
||||||
Frame,
|
Frame,
|
||||||
|
|
@ -188,12 +187,7 @@ impl DrawableComponent for PushComponent {
|
||||||
.border_type(BorderType::Thick)
|
.border_type(BorderType::Thick)
|
||||||
.border_style(self.theme.block(true)),
|
.border_style(self.theme.block(true)),
|
||||||
)
|
)
|
||||||
.gauge_style(
|
.gauge_style(self.theme.push_gauge())
|
||||||
//TODO: use theme
|
|
||||||
Style::default()
|
|
||||||
.fg(Color::White)
|
|
||||||
.bg(Color::Black),
|
|
||||||
)
|
|
||||||
.percent(u16::from(progress)),
|
.percent(u16::from(progress)),
|
||||||
area,
|
area,
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -47,6 +47,10 @@ pub struct Theme {
|
||||||
commit_author: Color,
|
commit_author: Color,
|
||||||
#[serde(with = "Color")]
|
#[serde(with = "Color")]
|
||||||
danger_fg: Color,
|
danger_fg: Color,
|
||||||
|
#[serde(with = "Color")]
|
||||||
|
push_gauge_bg: Color,
|
||||||
|
#[serde(with = "Color")]
|
||||||
|
push_gauge_fg: Color,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Theme {
|
impl Theme {
|
||||||
|
|
@ -220,6 +224,12 @@ impl Theme {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn push_gauge(&self) -> Style {
|
||||||
|
Style::default()
|
||||||
|
.fg(self.push_gauge_fg)
|
||||||
|
.bg(self.push_gauge_bg)
|
||||||
|
}
|
||||||
|
|
||||||
fn save(&self) -> Result<()> {
|
fn save(&self) -> Result<()> {
|
||||||
let theme_file = Self::get_theme_file()?;
|
let theme_file = Self::get_theme_file()?;
|
||||||
let mut file = File::create(theme_file)?;
|
let mut file = File::create(theme_file)?;
|
||||||
|
|
@ -276,6 +286,8 @@ impl Default for Theme {
|
||||||
commit_time: Color::LightCyan,
|
commit_time: Color::LightCyan,
|
||||||
commit_author: Color::Green,
|
commit_author: Color::Green,
|
||||||
danger_fg: Color::Red,
|
danger_fg: Color::Red,
|
||||||
|
push_gauge_bg: Color::White,
|
||||||
|
push_gauge_fg: Color::Red,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue