cosmic::cosmic_theme::palette::cast

Function from_uint_array

source
pub fn from_uint_array<T, const N: usize>(
    values: [<T as UintCast>::Uint; N],
) -> [T; N]
where T: UintCast,
Expand description

Cast from an array of unsigned integers to an array of colors.

use palette::{cast, rgb::PackedArgb, Srgba};

let colors: [PackedArgb; 2] = [
    Srgba::new(0x17, 0xC6, 0x4C, 0xFF).into(),
    Srgba::new(0x5D, 0x12, 0xD6, 0xFF).into()
];
assert_eq!(cast::from_uint_array::<PackedArgb, 2>([0xFF17C64C, 0xFF5D12D6]), colors)