Function yansi::enable

source ·
pub fn enable()
Expand description

Unconditionally enables styling globally.

By default, styling is enabled based on Condition::DEFAULT, which checks for operating system support.

§Example

use yansi::Paint;

// With styling disabled, ANSI color codes are _not_ emitted.
yansi::disable();
assert_eq!("go".green().to_string(), "go".to_string());

// Reenabling causes color code to be emitted.
yansi::enable();
assert_ne!("go".green().to_string(), "go".to_string());