mirror of
https://github.com/Hopiu/lychee.git
synced 2026-04-25 15:34:45 +00:00
Prettier colors and progress bar (#1069)
I've experimented a bit with the colors and these are the ones I
(currently) like best. The loader is taken from Python.
See https://stackoverflow.com/a/73724672
and 68224905f5/rich/progress_bar.py (LL70C16-L70C16)
This commit is contained in:
parent
530a30e00d
commit
2b08c250be
2 changed files with 7 additions and 8 deletions
|
|
@ -4,12 +4,12 @@ use once_cell::sync::Lazy;
|
|||
pub(crate) static NORMAL: Lazy<Style> = Lazy::new(Style::new);
|
||||
pub(crate) static DIM: Lazy<Style> = Lazy::new(|| Style::new().dim());
|
||||
|
||||
pub(crate) static GREEN: Lazy<Style> = Lazy::new(|| Style::new().green().bright());
|
||||
pub(crate) static BOLD_GREEN: Lazy<Style> = Lazy::new(|| Style::new().green().bold().bright());
|
||||
pub(crate) static GREEN: Lazy<Style> = Lazy::new(|| Style::new().color256(82).bright());
|
||||
pub(crate) static BOLD_GREEN: Lazy<Style> = Lazy::new(|| Style::new().color256(82).bold().bright());
|
||||
pub(crate) static YELLOW: Lazy<Style> = Lazy::new(|| Style::new().yellow().bright());
|
||||
pub(crate) static BOLD_YELLOW: Lazy<Style> = Lazy::new(|| Style::new().yellow().bold().bright());
|
||||
pub(crate) static PINK: Lazy<Style> = Lazy::new(|| Style::new().color256(197).bright());
|
||||
pub(crate) static BOLD_PINK: Lazy<Style> = Lazy::new(|| Style::new().color256(197).bold().bright());
|
||||
pub(crate) static PINK: Lazy<Style> = Lazy::new(|| Style::new().color256(197));
|
||||
pub(crate) static BOLD_PINK: Lazy<Style> = Lazy::new(|| Style::new().color256(197).bold());
|
||||
|
||||
// Write output using predefined colors
|
||||
macro_rules! color {
|
||||
|
|
|
|||
|
|
@ -190,10 +190,9 @@ async fn progress_bar_task(
|
|||
|
||||
fn init_progress_bar(initial_message: &'static str) -> ProgressBar {
|
||||
let bar = ProgressBar::new_spinner().with_style(
|
||||
ProgressStyle::with_template(
|
||||
"{spinner:.197.bright} {pos}/{len:.dim} ETA {eta} {bar:.dim} {wide_msg}",
|
||||
)
|
||||
.expect("Valid progress bar"),
|
||||
ProgressStyle::with_template("{spinner:.162} {pos}/{len:.238} {bar:.162/238} {wide_msg}")
|
||||
.expect("Valid progress bar")
|
||||
.progress_chars("━ ━"),
|
||||
);
|
||||
bar.set_length(0);
|
||||
bar.set_message(initial_message);
|
||||
|
|
|
|||
Loading…
Reference in a new issue