pub struct ColorHelper { /* private fields */ }Expand description
TTY-aware color helper that respects NO_COLOR and terminal detection
Implementations§
Source§impl ColorHelper
impl ColorHelper
Sourcepub fn should_color_stdout(&self) -> bool
pub fn should_color_stdout(&self) -> bool
Check if colors should be used for stdout
Sourcepub fn should_color_stderr(&self) -> bool
pub fn should_color_stderr(&self) -> bool
Check if colors should be used for stderr
Sourcepub fn red(&self, text: &str) -> ColoredString
pub fn red(&self, text: &str) -> ColoredString
Apply red color if colors are enabled
Sourcepub fn green(&self, text: &str) -> ColoredString
pub fn green(&self, text: &str) -> ColoredString
Apply green color if colors are enabled
Sourcepub fn blue(&self, text: &str) -> ColoredString
pub fn blue(&self, text: &str) -> ColoredString
Apply blue color if colors are enabled
Sourcepub fn yellow(&self, text: &str) -> ColoredString
pub fn yellow(&self, text: &str) -> ColoredString
Apply yellow color if colors are enabled
Sourcepub fn cyan(&self, text: &str) -> ColoredString
pub fn cyan(&self, text: &str) -> ColoredString
Apply cyan color if colors are enabled
Sourcepub fn magenta(&self, text: &str) -> ColoredString
pub fn magenta(&self, text: &str) -> ColoredString
Apply magenta color if colors are enabled
Sourcepub fn bold(&self, text: &str) -> ColoredString
pub fn bold(&self, text: &str) -> ColoredString
Apply bold formatting if colors are enabled
Sourcepub fn dimmed(&self, text: &str) -> ColoredString
pub fn dimmed(&self, text: &str) -> ColoredString
Apply dimmed formatting if colors are enabled
Sourcepub fn style(&self) -> StyleBuilder
pub fn style(&self) -> StyleBuilder
Chainable color and formatting methods
Trait Implementations§
Source§impl Clone for ColorHelper
impl Clone for ColorHelper
Source§fn clone(&self) -> ColorHelper
fn clone(&self) -> ColorHelper
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ColorHelper
impl RefUnwindSafe for ColorHelper
impl Send for ColorHelper
impl Sync for ColorHelper
impl Unpin for ColorHelper
impl UnwindSafe for ColorHelper
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more