Trait palette::FromComponent[][src]

pub trait FromComponent<T: Component> {
    fn from_component(other: T) -> Self;
}
Expand description

Converts from a color component type, while performing the appropriate scaling, rounding and clamping.

use palette::FromComponent;

// Scales the value up to u8::MAX while converting.
let u8_component = u8::from_component(1.0f32);
assert_eq!(u8_component, 255);

Required methods

Converts other into Self, while performing the appropriate scaling, rounding and clamping.

Implementors