Skip to main content

define_tag

Function define_tag 

Source
pub fn define_tag<S: Into<String>>(name: S, style: Style)
Available on crate feature std only.
Expand description

Define a reusable named style.

Only the color and attributes of style are stored; its text is ignored, so the idiom is to define from an empty style. Defining the same name again replaces the previous definition.

ยงExamples

use cli_forge::{define_tag, out, style, tag};

define_tag("error", style("").red().bold());
define_tag("hint", style("").cyan());

out(tag("error").render_with("build failed"));
out(tag("hint").render_with("try `--release`"));