~nytpu/rgb555conv

Converts 24 bit colors to 15 bit colors
fix readme typo
add contributing instructions
relicensed under GPL

clone

read-only
https://git.sr.ht/~nytpu/rgb555conv
read/write
git@git.sr.ht:~nytpu/rgb555conv

You can also use your local clone with git send-email.

#rgb555conv — converts 24 bit color to 15 bit color

I got tired of manually converting 24 bit hex colors (like 0xRRGGBB) into 15 bit BGR555 colors (like 0b0BBBBBGGGGGRRRRR) so I slapped this together to do it for me. Be warned that the 4 character color it outputs is in BGR format for use on the Game Boy Color and the Game Boy Advance instead of RGB. It also outputs a 24 bit representation of the 15 bit color (still in 0xRRGGBB) for use in things like your sprite software.

It outputs a rounded down and rounded up variant, it's up to you to look at it and decide which you like, because they may differ significantly.

Also, note that I do NO input checking beyond making sure that the color is provided in the first place, so use weird inputs at your own risk.

#compiling

git clone https://sr.ht/~nytpu/rgb555conv
cd rgb555conv
gcc -Wall -pedantic -O3 -o rgb555conv main.c

#contributing

send patches and reports to ~nytpu/public-inbox@lists.sr.ht