pub enum Color {
Hex(String),
Rgb(u8, u8, u8),
Rgba(u8, u8, u8, f32),
Named(String),
Var(String),
}Expand description
Represents a CSS color with type-safe operations
Supports multiple color formats: hex, RGB, RGBA, named colors, and CSS variables. Provides color manipulation methods like lighten, darken, and opacity adjustment.
§Examples
use rustyle_css::Color;
let primary = Color::hex("#007bff");
let with_opacity = primary.with_opacity(0.5);Variants§
Hex(String)
Hex color (e.g., #007bff or #007bff80 for alpha)
Rgb(u8, u8, u8)
RGB color (red, green, blue)
Rgba(u8, u8, u8, f32)
RGBA color (red, green, blue, alpha 0.0-1.0)
Named(String)
Named color (e.g., “red”, “blue”, “transparent”)
Var(String)
CSS variable (e.g., var(–primary-color))
Implementations§
Source§impl Color
impl Color
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Color
impl RefUnwindSafe for Color
impl Send for Color
impl Sync for Color
impl Unpin for Color
impl UnwindSafe for Color
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more