-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Sebastian Thiel
committed
Jun 4, 2019
1 parent
c8914ab
commit 9d430a2
Showing
4 changed files
with
66 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
use tui::buffer::Buffer; | ||
use tui::layout::Rect; | ||
use tui::style::{Color, Modifier, Style}; | ||
use tui::widgets::{Paragraph, Text, Widget}; | ||
|
||
pub struct Header; | ||
|
||
impl Widget for Header { | ||
fn draw(&mut self, area: Rect, buf: &mut Buffer) { | ||
let bg_color = Color::LightYellow; | ||
let text_color = Color::Black; | ||
let standard = Style { | ||
fg: text_color, | ||
bg: bg_color, | ||
..Default::default() | ||
}; | ||
let modified = |text: &'static str, modifier| { | ||
Text::Styled( | ||
text.into(), | ||
Style { | ||
modifier, | ||
..standard | ||
}, | ||
) | ||
}; | ||
let bold = |text: &'static str| modified(text, Modifier::BOLD); | ||
let italic = |text: &'static str| modified(text, Modifier::UNDERLINED); | ||
let text = |text: &'static str| Text::Styled(text.into(), standard); | ||
|
||
let lines = [ | ||
bold(" D"), | ||
text("isk "), | ||
bold("U"), | ||
text("sage "), | ||
bold("A"), | ||
text("alyzer v"), | ||
text(env!("CARGO_PKG_VERSION")), | ||
text(" "), | ||
italic("(press "), | ||
modified("?", Modifier::BOLD|Modifier::UNDERLINED), | ||
italic(" for help)"), | ||
]; | ||
Paragraph::new(lines.iter()) | ||
.style(Style { | ||
fg: text_color, | ||
bg: bg_color, | ||
..Default::default() | ||
}) | ||
.draw(area, buf); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
mod entries; | ||
mod footer; | ||
mod header; | ||
mod help; | ||
mod list; | ||
mod main; | ||
|
||
pub use entries::*; | ||
pub use footer::*; | ||
pub use header::*; | ||
pub use help::*; | ||
pub use list::*; | ||
pub use main::*; |