pub fn unpack_palette(palette: u8) -> [u8; 4] {
    let mut unpacked_palette = [0u8; 4];

    unpacked_palette
        .iter_mut()
        .enumerate()
        .for_each(|(idx, palette_entry)| {
            *palette_entry = (palette >> (idx as u8 * 2)) & 3;
        });

    unpacked_palette
}
/// Unpack palette from single byte to intensity values (0-3) for each of the four possible pixel
/// values.
///
/// From the Pandocs:
///
/// > - Bit 7-6 - Data for Dot Data `11` (Normally darkest color)
/// > - Bit 5-4 - Data for Dot Data `10`
/// > - Bit 3-2 - Data for Dot Data `01`
/// > - Bit 1-0 - Data for Dot Data `00` (Normally lightest color)
/// >
/// > This selects the shade of grays to use for the background (BG) & window pixels. Since each
/// > pixel uses 2 bits, the corresponding shade will be selected from here.
Unpack palette from single byte to intensity values (0-3) for each of the four possible pixel
values.

From the Pandocs.


Unpack palette from single byte to intensity values ( 0 - 3 ) for each of the four possible pixel values . From the Pandocs .
pub fn unpack_palette(palette: u8) -> [u8; 4] {
    let mut unpacked_palette = [0u8; 4];
    unpacked_palette
        .iter_mut()
        .enumerate()
        .for_each(|(idx, palette_entry)| {
            *palette_entry = (palette >> (idx as u8 * 2)) & 3;
        });
    unpacked_palette
}
pub fn unpack_palette ( palette : u8 ) -> [ u8 ; 4 ] { let mut unpacked_palette = [ 0u8 ; 4 ] ; unpacked_palette . iter_mut ( ) . enumerate ( ) . for_each ( | ( idx , palette_entry ) | { * palette_entry = ( palette >> ( idx as u8 * 2 ) ) & 3 ; } ) ; unpacked_palette }
Unpack palette from single byte to intensity values (0-3) for each of the four possible pixel
values.
Unpack palette from single byte to intensity values ( 0 - 3 ) for each of the four possible pixel values .
palette
u8
palette
u8