pub enum Color {
Rgb(f64, f64, f64),
Gray(f64),
Cmyk(f64, f64, f64, f64),
}Expand description
Represents a color in PDF documents.
Supports RGB, Grayscale, and CMYK color spaces.
Variants§
Rgb(f64, f64, f64)
RGB color (red, green, blue) with values from 0.0 to 1.0
Gray(f64)
Grayscale color with value from 0.0 (black) to 1.0 (white)
Cmyk(f64, f64, f64, f64)
CMYK color (cyan, magenta, yellow, key/black) with values from 0.0 to 1.0
Implementations§
Source§impl Color
impl Color
Sourcepub fn rgb(r: f64, g: f64, b: f64) -> Self
pub fn rgb(r: f64, g: f64, b: f64) -> Self
Creates an RGB color with values clamped to 0.0-1.0.
Sourcepub fn cmyk(c: f64, m: f64, y: f64, k: f64) -> Self
pub fn cmyk(c: f64, m: f64, y: f64, k: f64) -> Self
Creates a CMYK color with values clamped to 0.0-1.0.
pub fn yellow() -> Self
pub fn cyan() -> Self
pub fn magenta() -> Self
Sourcepub fn cmyk_cyan() -> Self
pub fn cmyk_cyan() -> Self
Pure cyan color in CMYK space (100% cyan, 0% magenta, 0% yellow, 0% black)
Sourcepub fn cmyk_magenta() -> Self
pub fn cmyk_magenta() -> Self
Pure magenta color in CMYK space (0% cyan, 100% magenta, 0% yellow, 0% black)
Sourcepub fn cmyk_yellow() -> Self
pub fn cmyk_yellow() -> Self
Pure yellow color in CMYK space (0% cyan, 0% magenta, 100% yellow, 0% black)
Sourcepub fn cmyk_black() -> Self
pub fn cmyk_black() -> Self
Pure black color in CMYK space (0% cyan, 0% magenta, 0% yellow, 100% black)
Sourcepub fn cmyk_components(&self) -> (f64, f64, f64, f64)
pub fn cmyk_components(&self) -> (f64, f64, f64, f64)
Get CMYK components (for CMYK colors, or conversion for others)
Sourcepub fn color_space_name(&self) -> &'static str
pub fn color_space_name(&self) -> &'static str
Get the color space name for PDF
Sourcepub fn to_pdf_array(&self) -> Object
pub fn to_pdf_array(&self) -> Object
Convert to PDF array representation
Trait Implementations§
impl Copy for Color
impl StructuralPartialEq for Color
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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