I used the png2src conversion before posting but some colours were not rendering. This and searching the web made me believe there might be a difference in file format (headers etc). But I just found out my understanding of setting up the palette in code was wrong. It seems I can use any indexed image as long as it does not use more than 4 colours in the image itself.
The explanation is a bit more programming focused, I will highlight some facts that might seem obvious if you already know a bit of programming.
The colours set in code seemed off by one, for example if I had the colours [c1,c2,c3,c4].
Whenever I set c2 to the image palette index 1 it would render c1. This was caused by me misunderstanding colour config.
In code you set 4 colours, this is not the colours in your image. These are used to set indexes later.
// Codes from aseprite palette:
w4.PALETTE.* = .{
0x344731,
0x6772a9,
0x3a3277,
0x9b1b95,
};
Now I can assign each index of a image to one of these.
This is done here from right to left.
// Set index image palette to chosen color earlier:
w4.DRAW_COLORS.* = 0x4320;
This was the cause of my issue. The colours I set in code earlier are also 4,
but I treated it as an array. Meaning for c1 I would have to set 0 in the above code.
But notice there is also a 4, this would be c5?
My mistake is the colour palette in the first code block is a struct not an array, and each field is labeled
from 1 and up so not 0 indexed. Setting 0 in the last code block means use the ‘transparent’ colour not
use the colour at index 0. There are no 0 indexes, for the first colour I would have to specify 1.
This might be more program related than pixelart but thanks for the help. Still unsure if there exists file formats for 1 - 2 bpp but for my purposes this works as intended. Below working result(limited to 1 upload so kinda cramped).
Running example:
I used 0 for the bomb highlight index here should be 1 but not an issue in example