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 uses a markup-language-like syntax to your string 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 markup string and appends a SGR reset, with arguments supported.
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.

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
try_color
Parses and renders a farben markup string, appending a final SGR reset.