Allow color palette to be defined by a file
It would be nice if the user could configure their own color palette.
Eventually we can add color selector to the gui.
For now, could we optionally import a file that contains the rgb values for our 16 colors? If the file doesn't exist when we start the app, default to the original color palette.
How can we handle this cleanly when importing a saved spritesheet? Can we add the color palette information inside the png file?
I haven't tried it myself, but I've heard that you can pack all kinds of metadata into png files beyond the basic pixel data. That's how, for instance, Pico8 is able to embed the entire game cartridge info into just the one png.
yeah, steganography! That would be cool if it's practical.
@dfirebaugh I would like to tackle this issue. Could you please assign it to me?
@dfirebaugh Could you take a look at the idea?
- Color palette file:
- Name: palette.cfg
- Format: Text file
- 16 lines of RGB color value in decimal
- Top down order, left-to-right corresponding to the 4x4 color palette
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
r,g,b
- Embedding the color palette information when saving png file
- Append color palette information (in binary format) to the PNG file
- Format: binary
| Byte size | Description |
|---|---|
| 8 | Header, fixed as "SPRITELY" |
| 48 | Array of 16 (R,G,B) values |
| 1 | Simple checksum: xor all 48 data bytes |