You are reading the documentation for string_colorization version 1.0.0
Abstracts colorizing string from the [colored] crate by giving a struct [Colorizer] combining foreground, background and stylizations to strings that can be applied later, and then uses them on the [colorize] function to allow you to colorize a string given a series substring and colorizers, for example, this code prints: R a i n b o w ':
; // Forces colorization,
// this won't be necessary in your code.
use ;
let rainbow = "Rainbow";
let default_colorizer = White+ true_color;
let colored_rainbow = colorize; // The letter 'n' wasn't reached by any of the other
// patterns, meaning the 'general_colorization'
// parameter will set its color, in this case, a white
// lettering, if not indicated, it wouldn't colorize
// the letter 'n', leaving it as plain.
println!; //Prints Rainbow with colors
assert_eq!;
set_override
If one of the rule's substring is a reference to another string different from the input argument, then the rule will just not be applied, for example, the following code prints 'Red, no red':
; // Forces colorization,
// this won't be necessary in your code.
use foreground;
let string_to_colorize = "Red, no red";
let another_string = "Another string";
let colorized_string = colorize; // from the input one (string_to_colorize),
// meaning no changes will be applied, and
// therefore, no text will turn green.
println!; //Prints 'Red' in red coloring and 'no red' without color.
assert_eq!;
set_override
Find more information and examples in the function [colorize] and the struct [Colorizer].