tilepalettemapper – Remaps color indices from the source bitmap to alternate indices on a

per-tile basis. This allows for altering coloring of tiles based on their tilegrid location. It also allows for using a limited color bitmap with a wider array of colors. (original) (raw)

Available on these boards

class tilepalettemapper.TilePaletteMapper(palette: displayio.Palette, input_color_count: int)

Create a TilePaletteMApper object to store a set of color mappings for tiles.

Parameters:

width_: int_

Width of the tile palette mapper in tiles.

height_: int_

Height of the tile palette mapper in tiles.

pixel_shader_: displayio.Palette | displayio.ColorConverter_

The palette or ColorConverter that the mapper uses.

tilegrid_: displayio.TileGrid_

The TileGrid that the TilePaletteMapper is used with.

__getitem__(index: Tuple[int, int] | int) → Tuple[int]

Returns the mapping for the given index. The index can either be an x,y tuple or an int equal to y * width + x.

This allows you to:

__setitem__(index: Tuple[int, int] | int, value: List[int]) → None

Sets the mapping at the given tile index. The index can either be an x,y tuple or an int equal to y * width + x.

This allows you to:

or: