mirror of
https://github.com/FliegendeWurst/cursive.git
synced 2024-11-23 17:35:00 +00:00
Add ColorStyle::{front, back} functions
This commit is contained in:
parent
ae0556c77d
commit
c3c3d4096f
@ -26,6 +26,22 @@ impl ColorStyle {
|
||||
Self { front, back }
|
||||
}
|
||||
|
||||
/// Uses the given color as front, inherits the parent background color.
|
||||
pub fn front<F>(front: F) -> Self
|
||||
where
|
||||
F: Into<ColorType>,
|
||||
{
|
||||
Self::new(front, ColorType::InheritParent)
|
||||
}
|
||||
|
||||
/// Uses the given color as background, inherits the parent front color.
|
||||
pub fn back<B>(back: B) -> Self
|
||||
where
|
||||
B: Into<ColorType>,
|
||||
{
|
||||
Self::new(ColorType::InheritParent, back)
|
||||
}
|
||||
|
||||
/// Style set by terminal before entering a Cursive program.
|
||||
pub fn terminal_default() -> Self {
|
||||
Self::new(Color::TerminalDefault, Color::TerminalDefault)
|
||||
|
Loading…
Reference in New Issue
Block a user