Use new highlight colors for editor and pseudo messages

This commit is contained in:
Joscha 2022-08-03 01:12:31 +02:00
parent 3fd08fd399
commit 01ee4b4ce8
3 changed files with 45 additions and 46 deletions

View file

@ -1,4 +1,4 @@
use crossterm::style::{ContentStyle, Stylize};
use crossterm::style::ContentStyle;
use time::format_description::FormatItem;
use time::macros::format_description;
use time::OffsetDateTime;
@ -11,21 +11,7 @@ use crate::ui::widgets::BoxedWidget;
const TIME_FORMAT: &[FormatItem<'_>] = format_description!("[year]-[month]-[day] [hour]:[minute]");
const TIME_WIDTH: u16 = 16;
fn style() -> ContentStyle {
ContentStyle::default().grey()
}
fn style_inverted() -> ContentStyle {
ContentStyle::default().black().on_white()
}
pub fn widget(time: Option<OffsetDateTime>, highlighted: bool) -> BoxedWidget {
let style = if highlighted {
style_inverted()
} else {
style()
};
pub fn widget(time: Option<OffsetDateTime>, style: ContentStyle) -> BoxedWidget {
if let Some(time) = time {
let text = time.format(TIME_FORMAT).expect("could not format time");
Background::new(Text::new((text, style)))