Make current day stand out more
This commit is contained in:
parent
8af268bd68
commit
e01de41925
1 changed files with 9 additions and 12 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
use std::cmp;
|
use std::cmp;
|
||||||
|
|
||||||
use chrono::{Datelike, NaiveDate};
|
use chrono::{Datelike, NaiveDate};
|
||||||
use colored::{Color, ColoredString, Colorize};
|
use colored::{ColoredString, Colorize};
|
||||||
|
|
||||||
use crate::files::primitives::{Time, Weekday};
|
use crate::files::primitives::{Time, Weekday};
|
||||||
|
|
||||||
|
|
@ -41,17 +41,19 @@ impl ShowLines {
|
||||||
let weekday: Weekday = date.weekday().into();
|
let weekday: Weekday = date.weekday().into();
|
||||||
let weekday = weekday.full_name();
|
let weekday = weekday.full_name();
|
||||||
|
|
||||||
let color = if today {
|
let styled = |s: &str| {
|
||||||
Color::BrightCyan
|
if today {
|
||||||
} else {
|
s.bright_cyan().bold()
|
||||||
Color::Cyan
|
} else {
|
||||||
|
s.cyan()
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// '=' symbols before the spans start
|
// '=' symbols before the spans start
|
||||||
let p1 = format!("{:=<w$}=", "", w = self.num_width);
|
let p1 = format!("{:=<w$}=", "", w = self.num_width);
|
||||||
|
|
||||||
// Spans and filler '=' symbols
|
// Spans and filler '=' symbols
|
||||||
let p2 = self.display_spans(spans, "=".color(color).bold());
|
let p2 = self.display_spans(spans, styled("="));
|
||||||
|
|
||||||
// The rest of the line
|
// The rest of the line
|
||||||
let p3 = format!(
|
let p3 = format!(
|
||||||
|
|
@ -62,12 +64,7 @@ impl ShowLines {
|
||||||
w = self.num_width + self.span_width
|
w = self.num_width + self.span_width
|
||||||
);
|
);
|
||||||
|
|
||||||
self.push(&format!(
|
self.push(&format!("{}{}{}\n", styled(&p1), p2, styled(&p3)));
|
||||||
"{}{}{}\n",
|
|
||||||
p1.color(color).bold(),
|
|
||||||
p2,
|
|
||||||
p3.color(color).bold()
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_line_now(&mut self, spans: &[Option<SpanSegment>], time: Time) {
|
fn display_line_now(&mut self, spans: &[Option<SpanSegment>], time: Time) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue