Skip to main content

palette_color_to_rgba

Function palette_color_to_rgba 

Source
pub const fn palette_color_to_rgba(
    palette: PpuPalette,
    idx: u8,
    emph_red: bool,
    emph_green: bool,
    emph_blue: bool,
) -> [u8; 4]
Expand description

Convert a 6-bit color index to RGBA8 under the active PPU palette, applying the palette’s emphasis model.

The default PpuPalette::Composite2C02 path is byte-for-byte identical to apply_emphasis(nes_color_to_rgba(idx), ...) so normal NES/Famicom rendering is unchanged.

On the RGB PPUs (2C03 / 2C04 / 2C05) emphasis works the opposite way from the 2C02: rather than darkening the non-emphasized channels, each set emphasis bit forces its own channel to full brightness (0xFF). Per nesdev “PPU palettes”: “emphasis on the RGB chips works differently; rather than ‘darkening’ the specific color chosen, it sets the corresponding channel to full brightness instead.”