palette::cast

Function into_component_slice

source
pub fn into_component_slice<T>(values: &[T]) -> &[<T::Array as ArrayExt>::Item]
where T: ArrayCast,
Expand description

Cast from a slice of colors to a slice of color components.

use palette::{cast, Srgb};

let colors = &[Srgb::new(64u8, 139, 10), Srgb::new(93, 18, 214)];
assert_eq!(cast::into_component_slice(colors), &[64, 139, 10, 93, 18, 214])