neco-tui 0.1.0

Zero-dependency minimal ANSI terminal helpers
Documentation
  • Coverage
  • 52.94%
    9 out of 17 items documented3 out of 8 items with examples
  • Size
  • Source code size: 9.69 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.83 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 14s Average build duration of successful builds.
  • all releases: 14s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • barineco/neco-crates
    3 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • barineco

neco-tui

日本語

Zero-dependency minimal ANSI terminal helpers. Provides text styling via SGR escape sequences.

Usage

Styled text

use neco_tui::{style, Color};

// Foreground color
println!("{}", style("ok").fg(Color::Green));

// Bold + color
println!("{}", style("error").fg(Color::Red).bold());

// Dim display
println!("{}", style("hint").dim());

Composing styles

The builder returned by style() supports method chaining. It implements Display for use with println! and format!.

use neco_tui::{style, Color, Style};

let prompt = format!(
    "{}@{} > ",
    style("host").fg(Color::Blue),
    style("user").fg(Color::Cyan).bold(),
);

API

Item Description
style(text) Returns a style builder
Styled::fg(color) Set foreground color
Styled::bold() Bold text
Styled::dim() Dim text
Color Standard 8 colors (Black, Red, Green, Yellow, Blue, Magenta, Cyan, White)
Style::RESET SGR reset sequence (\x1b[0m)

License

MIT