Skip to main content

Module colorize

Module colorize 

Source
Expand description

Rainbow ANSI colorizer for terminal output. Helpers to colorize text with a left-to-right rainbow.

Provides:

  • colorize_text_with_width(text, Option<usize>) -> String

The functions emit 24-bit ANSI foreground escapes (\x1b[38;2;R;G;Bm). If rainbow_width is None the rainbow spans the widest line in text. The output contains newline characters and is ready to print.

Functionsยง

colorize_text_with_width
Colorize the provided text with a left-to-right rainbow. If rainbow_width is None the rainbow will span the full width of the widest line. If a width is provided the gradient is computed across that width and repeats when lines are longer.