pub struct PdfColor { /* private fields */ }Expand description
A 32-bit RGB color value with an optional alpha channel.
A variety of non-transparent colors are available as const values on this struct.
Note that when used as a form field highlight color, a solid color with no opacity will overprint any user data in the field. Use the PdfColor::with_alpha() function to apply an alpha channel value to an existing PdfColor.
Implementations§
Source§impl PdfColor
impl PdfColor
pub const WHITE: PdfColor
pub const BLACK: PdfColor
pub const SOLID_WHITE: PdfColor
pub const SOLID_RED: PdfColor
pub const SOLID_GREEN: PdfColor
pub const SOLID_BLUE: PdfColor
pub const SOLID_MAGENTA: PdfColor
pub const SOLID_CYAN: PdfColor
pub const SOLID_YELLOW: PdfColor
pub const SOLID_BLACK: PdfColor
pub const GREY_90: PdfColor
pub const GREY_80: PdfColor
pub const GREY_70: PdfColor
pub const GREY_60: PdfColor
pub const GREY_50: PdfColor
pub const GREY_40: PdfColor
pub const GREY_30: PdfColor
pub const GREY_20: PdfColor
pub const GREY_10: PdfColor
pub const LIME: PdfColor
pub const BLUE: PdfColor
pub const YELLOW: PdfColor
pub const CYAN: PdfColor
pub const MAGENTA: PdfColor
pub const SILVER: PdfColor
pub const OLIVE: PdfColor
pub const PURPLE: PdfColor
pub const TEAL: PdfColor
pub const NAVY: PdfColor
pub const MAROON: PdfColor
pub const DARK_RED: PdfColor
pub const BROWN: PdfColor
pub const FIREBRICK: PdfColor
pub const CRIMSON: PdfColor
pub const RED: PdfColor
pub const TOMATO: PdfColor
pub const CORAL: PdfColor
pub const INDIAN_RED: PdfColor
pub const LIGHT_CORAL: PdfColor
pub const DARK_SALMON: PdfColor
pub const SALMON: PdfColor
pub const LIGHT_SALMON: PdfColor
pub const ORANGE_RED: PdfColor
pub const DARK_ORANGE: PdfColor
pub const ORANGE: PdfColor
pub const GOLD: PdfColor
pub const DARK_GOLDEN_ROD: PdfColor
pub const GOLDEN_ROD: PdfColor
pub const PALE_GOLDEN_ROD: PdfColor
pub const DARK_KHAKI: PdfColor
pub const KHAKI: PdfColor
pub const YELLOW_GREEN: PdfColor
pub const DARK_OLIVE_GREEN: PdfColor
pub const OLIVE_DRAB: PdfColor
pub const LAWN_GREEN: PdfColor
pub const CHARTREUSE: PdfColor
pub const GREEN_YELLOW: PdfColor
pub const DARK_GREEN: PdfColor
pub const GREEN: PdfColor
pub const FOREST_GREEN: PdfColor
pub const LIME_GREEN: PdfColor
pub const LIGHT_GREEN: PdfColor
pub const PALE_GREEN: PdfColor
pub const DARK_SEA_GREEN: PdfColor
pub const MEDIUM_SPRING_GREEN: PdfColor
pub const SPRING_GREEN: PdfColor
pub const SEA_GREEN: PdfColor
pub const MEDIUM_AQUA_MARINE: PdfColor
pub const MEDIUM_SEA_GREEN: PdfColor
pub const LIGHT_SEA_GREEN: PdfColor
pub const DARK_SLATE_GRAY: PdfColor
pub const DARK_CYAN: PdfColor
pub const AQUA: PdfColor
pub const LIGHT_CYAN: PdfColor
pub const DARK_TURQUOISE: PdfColor
pub const TURQUOISE: PdfColor
pub const MEDIUM_TURQUOISE: PdfColor
pub const PALE_TURQUOISE: PdfColor
pub const AQUA_MARINE: PdfColor
pub const POWDER_BLUE: PdfColor
pub const CADET_BLUE: PdfColor
pub const STEEL_BLUE: PdfColor
pub const CORNFLOWER_BLUE: PdfColor
pub const DEEP_SKY_BLUE: PdfColor
pub const DODGER_BLUE: PdfColor
pub const LIGHT_BLUE: PdfColor
pub const SKY_BLUE: PdfColor
pub const LIGHT_SKY_BLUE: PdfColor
pub const MIDNIGHT_BLUE: PdfColor
pub const DARK_BLUE: PdfColor
pub const MEDIUM_BLUE: PdfColor
pub const ROYAL_BLUE: PdfColor
pub const BLUE_VIOLET: PdfColor
pub const INDIGO: PdfColor
pub const DARK_SLATE_BLUE: PdfColor
pub const SLATE_BLUE: PdfColor
pub const MEDIUM_SLATE_BLUE: PdfColor
pub const MEDIUM_PURPLE: PdfColor
pub const DARK_MAGENTA: PdfColor
pub const DARK_VIOLET: PdfColor
pub const DARK_ORCHID: PdfColor
pub const MEDIUM_ORCHID: PdfColor
pub const THISTLE: PdfColor
pub const PLUM: PdfColor
pub const VIOLET: PdfColor
pub const ORCHID: PdfColor
pub const MEDIUM_VIOLET_RED: PdfColor
pub const PALE_VIOLET_RED: PdfColor
pub const DEEP_PINK: PdfColor
pub const HOT_PINK: PdfColor
pub const LIGHT_PINK: PdfColor
pub const PINK: PdfColor
pub const ANTIQUE_WHITE: PdfColor
pub const BEIGE: PdfColor
pub const BISQUE: PdfColor
pub const BLANCHED_ALMOND: PdfColor
pub const WHEAT: PdfColor
pub const CORN_SILK: PdfColor
pub const LEMON_CHIFFON: PdfColor
pub const LIGHT_GOLDEN_ROD_YELLOW: PdfColor
pub const LIGHT_YELLOW: PdfColor
pub const SADDLE_BROWN: PdfColor
pub const SIENNA: PdfColor
pub const CHOCOLATE: PdfColor
pub const PERU: PdfColor
pub const SANDY_BROWN: PdfColor
pub const BURLY_WOOD: PdfColor
pub const TAN: PdfColor
pub const ROSY_BROWN: PdfColor
pub const MOCCASIN: PdfColor
pub const NAVAJO_WHITE: PdfColor
pub const PEACH_PUFF: PdfColor
pub const MISTY_ROSE: PdfColor
pub const LAVENDER_BLUSH: PdfColor
pub const LINEN: PdfColor
pub const OLD_LACE: PdfColor
pub const PAPAYA_WHIP: PdfColor
pub const SEA_SHELL: PdfColor
pub const MINT_CREAM: PdfColor
pub const SLATE_GRAY: PdfColor
pub const LIGHT_SLATE_GRAY: PdfColor
pub const LIGHT_STEEL_BLUE: PdfColor
pub const LAVENDER: PdfColor
pub const FLORAL_WHITE: PdfColor
pub const ALICE_BLUE: PdfColor
pub const GHOST_WHITE: PdfColor
pub const HONEYDEW: PdfColor
pub const IVORY: PdfColor
pub const AZURE: PdfColor
pub const SNOW: PdfColor
pub const DIM_GREY: PdfColor
pub const GREY: PdfColor
pub const DARK_GREY: PdfColor
pub const LIGHT_GREY: PdfColor
pub const GAINSBORO: PdfColor
pub const WHITE_SMOKE: PdfColor
Sourcepub const fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self
pub const fn new(red: u8, green: u8, blue: u8, alpha: u8) -> Self
Constructs a new PdfColor object from the given arguments.
Sourcepub fn from_hex(hex: &str) -> Result<Self, PdfiumError>
pub fn from_hex(hex: &str) -> Result<Self, PdfiumError>
Returns the result of importing the given hexadecimal color specification,
as in HTML. For example, #800080 represents a shade of purple with 100% opacity,
and #40800080 is the same shade of purple with 25% opacity. The leading hash
symbol is required.
Sourcepub const fn mix(a: &PdfColor, b: &PdfColor) -> Self
pub const fn mix(a: &PdfColor, b: &PdfColor) -> Self
Returns the result of averaging the RGB and alpha values of the two given PdfColor objects.
Sourcepub const fn with_alpha(&self, alpha: u8) -> Self
pub const fn with_alpha(&self, alpha: u8) -> Self
Constructs a new PdfColor by copying the red, green, and blue color components of this color and applying the given alpha value.
Sourcepub fn alpha(&self) -> u8
pub fn alpha(&self) -> u8
Returns the alpha (opacity) component of this color, with 0 = completely transparent and 255 = completely opaque (solid).
Sourcepub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
Returns the hexadecimal representation of this color, as in HTML, without
a leading hash symbol. Excludes the alpha channel value. For example,
PdfColor::PURPLE.to_hex() will return “800080”.
Sourcepub fn to_hex_with_alpha(&self) -> String
pub fn to_hex_with_alpha(&self) -> String
Returns the hexadecimal representation of this color, as in HTML, without
a leading hash symbol. Includes the alpha channel value. For example,
PdfColor::PURPLE.to_hex_with_alpha() will return “FF800080”.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PdfColor
impl RefUnwindSafe for PdfColor
impl Send for PdfColor
impl Sync for PdfColor
impl Unpin for PdfColor
impl UnwindSafe for PdfColor
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> 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