pub enum Color {
Simple(SimpleColor),
Indexed(IndexedColor),
RGB(RGBColor),
}Expand description
An enum representing all supported color types.
Variants§
Simple(SimpleColor)
A simple color (16 colors).
Indexed(IndexedColor)
An 8-bit color (256 colors).
RGB(RGBColor)
An RGB color (24-bit/true color).
Implementations§
Source§impl Color
impl Color
Sourcepub const BLACK: BasicColor = BasicColor::Black
pub const BLACK: BasicColor = BasicColor::Black
Constant for the basic color black.
Sourcepub const RED: BasicColor = BasicColor::Red
pub const RED: BasicColor = BasicColor::Red
Constant for the basic color red.
Sourcepub const GREEN: BasicColor = BasicColor::Green
pub const GREEN: BasicColor = BasicColor::Green
Constant for the basic color green.
Sourcepub const YELLOW: BasicColor = BasicColor::Yellow
pub const YELLOW: BasicColor = BasicColor::Yellow
Constant for the basic color yellow.
Sourcepub const BLUE: BasicColor = BasicColor::Blue
pub const BLUE: BasicColor = BasicColor::Blue
Constant for the basic color blue.
Sourcepub const MAGENTA: BasicColor = BasicColor::Magenta
pub const MAGENTA: BasicColor = BasicColor::Magenta
Constant for the basic color magenta.
Sourcepub const CYAN: BasicColor = BasicColor::Cyan
pub const CYAN: BasicColor = BasicColor::Cyan
Constant for the basic color cyan.
Sourcepub const WHITE: BasicColor = BasicColor::White
pub const WHITE: BasicColor = BasicColor::White
Constant for the basic color white.
Sourcepub const fn indexed(value: u8) -> IndexedColor
pub const fn indexed(value: u8) -> IndexedColor
Create an 8-bit color from the given value.
Sourcepub const fn rgb(r: u8, g: u8, b: u8) -> RGBColor
pub const fn rgb(r: u8, g: u8, b: u8) -> RGBColor
Create an RGB color from the given red, green, and blue components.
Sourcepub const fn none() -> Option<Color>
pub const fn none() -> Option<Color>
Helper method to return a None value.
Use it to clear the color for some target with Style::set_color()
or Styled<C>::set_color().
Source§impl Color
impl Color
Sourcepub fn for_fg(self) -> TargetedColor
pub fn for_fg(self) -> TargetedColor
Associate this color with the foreground plane.
Sourcepub fn for_bg(self) -> TargetedColor
pub fn for_bg(self) -> TargetedColor
Associate this color with the background plane.
Sourcepub fn for_underline(self) -> TargetedColor
pub fn for_underline(self) -> TargetedColor
Associate this color with the underline effect.
Sourcepub fn for_target(self, target: ColorTarget) -> TargetedColor
pub fn for_target(self, target: ColorTarget) -> TargetedColor
Associate this color with the specified color target.
Source§impl Color
impl Color
Sourcepub fn underline(self) -> Style
pub fn underline(self) -> Style
An alias for Self::solid_underline().
Sourcepub fn solid_underline(self) -> Style
pub fn solid_underline(self) -> Style
Sets the solid underline effect.
Sourcepub fn curly_underline(self) -> Style
pub fn curly_underline(self) -> Style
Sets the curly underline effect.
Sourcepub fn dotted_underline(self) -> Style
pub fn dotted_underline(self) -> Style
Sets the dotted underline effect.
Sourcepub fn dashed_underline(self) -> Style
pub fn dashed_underline(self) -> Style
Sets the dashed underline effect.
Sourcepub fn strikethrough(self) -> Style
pub fn strikethrough(self) -> Style
Sets the strikethrough effect.
Sourcepub fn double_underline(self) -> Style
pub fn double_underline(self) -> Style
Sets the double underline effect.
Sourcepub fn underline_effect(self, underline_effect: UnderlineEffect) -> Style
pub fn underline_effect(self, underline_effect: UnderlineEffect) -> Style
Sets the underline effect.
Sourcepub fn underline_color(self, color: impl Into<Color>) -> Style
pub fn underline_color(self, color: impl Into<Color>) -> Style
Sets the underline color.
Sourcepub fn color(self, targeted_color: impl Into<TargetedColor>) -> Style
pub fn color(self, targeted_color: impl Into<TargetedColor>) -> Style
Sets the given color in a target.
Sourcepub fn add(self, element: impl StylingElement<Style>) -> Style
pub fn add(self, element: impl StylingElement<Style>) -> Style
Adds the given element to the style.
Sourcepub fn applied_to<C: Display>(self, content: C) -> Styled<C>
pub fn applied_to<C: Display>(self, content: C) -> Styled<C>
Applies the styling to the given content, returning a Styled<C> instance.
Source§impl Color
impl Color
Sourcepub fn to_targeted_color(self) -> TargetedColor
pub fn to_targeted_color(self) -> TargetedColor
Converts the type into a TargetedColor