pub fn into_array<T>(color: T) -> <T as ArrayCast>::Arraywhere
T: ArrayCast,
Expand description
Cast from a color type to an array.
use palette::{cast, Srgb};
let color = Srgb::new(23u8, 198, 76);
assert_eq!(cast::into_array(color), [23, 198, 76]);
It’s also possible to use From
and Into
when casting built-in types:
use palette::Srgb;
let color = Srgb::new(23u8, 198, 76);
// Colors implement `Into`:
let array1: [_; 3] = color.into();
// Arrays implement `From`:
let array2 = <[_; 3]>::from(color);