Skip to main content

Crate farben

Crate farben 

Source
Expand description

§Introduction

Farben (as in “color” in German) is a zero-dependency terminal coloring library. Farben applies a markup-like syntax to your strings and outputs them colored. For example:

§Example

use farben::*;

let colored = color("[red]I'm red!");
assert_eq!(colored, "\x1b[31mI'm red!\x1b[0m");

Macros§

color_fmt
Parses and renders a farben markup string with format arguments, appending a final SGR reset.
cprint
Prints farben-colored markup to stdout without a newline.
cprintb
Prints farben-colored markup to stdout without a newline, without appending a reset.
cprintbln
Prints farben-colored markup to stdout with a trailing newline, without appending a reset.
cprintln
Prints farben-colored markup to stdout with a trailing newline.
prefix
Sets a prefix string on a previously defined named style.
style
Defines a named style in the global registry.

Structs§

Style
A complete set of visual attributes for a span of text.

Functions§

color
Parses and renders a farben markup string, appending a final SGR reset.
color_runtime
Parses and renders a farben markup string, appending a final SGR reset.
colorb
Parses and renders a farben markup string, appending a final SGR reset, without appending a trailing reset sequence.
insert_style
Registers a named style in the global registry.
try_color
Parses and renders a farben markup string, appending a final SGR reset.