Module yacll::stylize

source ·
Expand description

Enums and structs used for stylizing text and the cursor.

use yacll::stylize::{Styler, Style, Color, Attr, reset};
use yacll::Yogurt;

// my very cool (and not at all unreadable) style
fn cool_style() -> Style {
    Styler::new()
        .foreground(Color::Red)
        .background(Color::Blue)
        .underline(Color::Green)
        .attr(Attr::Underlined)
        .attr(Attr::Overlined)
        .attr(Attr::Strikethrough)
        .attr(Attr::Bold)
        .attr(Attr::Italic)
        .style()
}

fn main() -> yacll::Result<()> {
    let mut y = Yogurt::new();
    y.style(cool_style());
    y.print("Hello, world!\n")?;
    y.style(reset());
    y.flush()?;
    Ok(())
}
// try running `$ cargo run --example=style` if you have the repository cloned!

Structs

The style that can be put on content.
Style builder.

Enums

Represents an attribute.
Represents a color.
Possible cursor attributes. See also cursor_off and cursor_on.

Constants

Border to use with draw_box.
Border to use with draw_box.

Functions

Returns a style that resets all colors and attributes.