Struct colored::ColoredString [−][src]
A string that may have color and/or style applied to it.
Implementations
impl ColoredString
[src][−]
pub fn fgcolor(&self) -> Option<Color>
[src][−]
Get the current background color applied.
let cstr = "".blue(); assert_eq!(cstr.fgcolor(), Some(Color::Blue)); let cstr = cstr.clear(); assert_eq!(cstr.fgcolor(), None);
pub fn bgcolor(&self) -> Option<Color>
[src][−]
Get the current background color applied.
let cstr = "".on_blue(); assert_eq!(cstr.bgcolor(), Some(Color::Blue)); let cstr = cstr.clear(); assert_eq!(cstr.bgcolor(), None);
pub fn style(&self) -> Style
[src][−]
Get the current Style
which can be check if it contains a Styles
.
let colored = "".bold().italic(); assert_eq!(colored.style().contains(Styles::Bold), true); assert_eq!(colored.style().contains(Styles::Italic), true); assert_eq!(colored.style().contains(Styles::Dimmed), false);
pub fn is_plain(&self) -> bool
[src][−]
Checks if the colored string has no color or styling.
let cstr = "".red(); assert_eq!(cstr.is_plain(), false); let cstr = cstr.clear(); assert_eq!(cstr.is_plain(), true);
Trait Implementations
impl Clone for ColoredString
[src][+]
impl Colorize for ColoredString
[src][+]
impl Debug for ColoredString
[src][+]
impl Default for ColoredString
[src][+]
impl Deref for ColoredString
[src][+]
impl Display for ColoredString
[src][+]
impl Eq for ColoredString
[src]
impl<'a> From<&'a str> for ColoredString
[src][+]
impl PartialEq<ColoredString> for ColoredString
[src][+]
impl StructuralEq for ColoredString
[src]
impl StructuralPartialEq for ColoredString
[src]
Auto Trait Implementations
impl RefUnwindSafe for ColoredString
impl Send for ColoredString
impl Sync for ColoredString
impl Unpin for ColoredString
impl UnwindSafe for ColoredString
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src][+]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src][+]
T: ?Sized,
impl<T> From<T> for T
[src][+]
impl<T, U> Into<U> for T where
U: From<T>,
[src][+]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src][+]
T: Clone,
impl<T> ToString for T where
T: Display + ?Sized,
[src][+]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src][+]
U: Into<T>,
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src][+]
U: TryFrom<T>,