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