cosmic::cosmic_theme::palette::cast

Function into_uint_slice_box

source
pub fn into_uint_slice_box<T>(values: Box<[T]>) -> Box<[<T as UintCast>::Uint]>
where T: UintCast,
Expand description

Cast from a boxed slice of colors to a boxed slice of unsigned integers.

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

let colors: Box<[PackedArgb]> = vec![
    Srgba::new(0x17, 0xC6, 0x4C, 0xFF).into(),
    Srgba::new(0x5D, 0x12, 0xD6, 0xFF).into()
].into_boxed_slice();

assert_eq!(
    cast::into_uint_slice_box(colors),
    vec![0xFF17C64C, 0xFF5D12D6].into_boxed_slice()
)