tap-rs 1.6.3

A lightweight CLI library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
use std::sync::atomic::{AtomicBool, Ordering};

use crate::tooling::console::{colors, styles::Text};

pub static COLOR_ENABLED: AtomicBool = AtomicBool::new(true);

pub fn colorize(s: &str) -> String {
    let colored = COLOR_ENABLED.load(Ordering::Relaxed);
    let mut text = Text::new();
    colors::colorize(s, &mut text);
    text.get(colored)
}