Crate anstyle

Source
Expand description

ANSI Text Styling

A portmanteau of “ansi style”

anstyle provides core types describing ANSI styling escape codes for interoperability between crates.

Example use cases:

  • An argument parser allowing callers to define the colors used in the help-output without putting the text formatting crate in the public API
  • A style description parser that can work with any text formatting crate

Priorities:

  1. API stability
  2. Low compile-time and binary-size overhead
  3. const friendly API for callers to statically define their stylesheet

For integration with text styling crate, see:

User-styling parsers:

Convert to other formats

Utilities

§Examples

The core type is Style:

let style = anstyle::Style::new().bold();

Structs§

Ansi256Color
256 (8-bit) color support
EffectIter
Enumerate each enabled value in Effects
Effects
A set of text effects
Reset
Reset terminal formatting
RgbColor
24-bit ANSI RGB color codes
Style
ANSI Text styling

Enums§

AnsiColor
Available 4-bit ANSI color palette codes
Color
Any ANSI color code scheme