pub trait Color: Copy {
// Required methods
fn blend_over(self, other: Self) -> Self;
fn with_alpha(self, alpha: Scalar) -> Self;
fn to_rgba(self) -> [u8; 4];
fn lerp(self, other: Self, t: f32) -> Self;
// Provided methods
fn to_rgb(self) -> [u8; 3] { ... }
fn luma(self) -> f32 { ... }
fn best_contrast(self, c0: Self, c1: Self) -> Self { ... }
}
Expand description
Common interface to all color representations
Required Methods§
sourcefn blend_over(self, other: Self) -> Self
fn blend_over(self, other: Self) -> Self
Blend other color on top of this color
sourcefn with_alpha(self, alpha: Scalar) -> Self
fn with_alpha(self, alpha: Scalar) -> Self
Override alpha component of the color
Provided Methods§
sourcefn best_contrast(self, c0: Self, c1: Self) -> Self
fn best_contrast(self, c0: Self, c1: Self) -> Self
Pick color that produces the best contrast with self
Object Safety§
This trait is not object safe.