pk-hack / CoilSnake

https://pk-hack.github.io/CoilSnake/
GNU General Public License v3.0
158 stars 37 forks source link

Fix palette bug when image file has less than the expected number of colours #260

Closed charasyn closed 1 year ago

charasyn commented 1 year ago

Previously, when getting the palette from an image file with less than the expected number of colours, CoilSnake would raise an IndexError due to indexing outside the bounds of the palette array. Now, we will substitute in (0,0,0) instead.

Additionally, the palette class was refactored to avoid code duplication.