Struct terminal_menu::TerminalMenuItem
source · pub struct TerminalMenuItem { /* private fields */ }
Implementations§
source§impl TerminalMenuItem
impl TerminalMenuItem
sourcepub fn colorize(self, color: Color) -> Self
pub fn colorize(self, color: Color) -> Self
Set a color to print the item in.
Example
use terminal_menu::{menu, label, scroll};
use crossterm::style::Color;
let menu = menu(vec![
label("Colorize me").colorize(Color::Magenta),
scroll("Me too!", vec!["foo", "bar"]).colorize(Color::Green)
]);
Examples found in repository?
examples/colors.rs (line 14)
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
fn main() {
use terminal_menu::*;
// see the crossterm crate for all the color options
use crossterm::style::Color;
let menu = menu(vec![
label("COLOR!"),
label("Red").colorize(Color::Red),
label("Green").colorize(Color::Green),
label("Blue").colorize(Color::Blue),
// selected item is always cyan
button("Cyan")
]);
run(&menu);
}
Auto Trait Implementations§
impl RefUnwindSafe for TerminalMenuItem
impl Send for TerminalMenuItem
impl Sync for TerminalMenuItem
impl Unpin for TerminalMenuItem
impl UnwindSafe for TerminalMenuItem
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more