diff --git a/agb/src/display/tiled/vram_manager.rs b/agb/src/display/tiled/vram_manager.rs index 2a482a69..4339d56b 100644 --- a/agb/src/display/tiled/vram_manager.rs +++ b/agb/src/display/tiled/vram_manager.rs @@ -463,9 +463,16 @@ impl VRamManager { } /// Gets the index of the colour for a given background palette, or None if it doesn't exist - pub fn find_colour_index_16(&mut self, palette_index: usize, colour: u16) -> Option { + #[must_use] + pub fn find_colour_index_16(&self, palette_index: usize, colour: u16) -> Option { assert!(palette_index < 16); (0..16).find(|i| PALETTE_BACKGROUND.get(palette_index * 16 + i) == colour) } + + /// Gets the index of the colour in the entire background palette, or None if it doesn't exist + #[must_use] + pub fn find_colour_index_256(&self, colour: u16) -> Option { + (0..256).find(|&i| PALETTE_BACKGROUND.get(i) == colour) + } }