Function yansi::is_enabled
source · pub fn is_enabled() -> bool
Expand description
Returns true
if styling is globally enabled and false
otherwise.
By default, styling is enabled based on Condition::DEFAULT
, which checks
for operating system support. It can be enabled and disabled on-the-fly with
enable()
and disable()
and via a dynamic condition with
whenever()
.
§Example
// Styling is enabled by default.
assert!(yansi::is_enabled());
// Disable it with `Painted::disable()`.
yansi::disable();
assert!(!yansi::is_enabled());
// Reenable with `Painted::enable()`.
yansi::enable();
assert!(yansi::is_enabled());