tb1/tb1_snes/tools/color_convert.c
Vince Weaver dbaf404ec3 snes: rename tb_snes to tb1_snes
I kept typing it wrong anyway, and hey, git makes rename easy
2013-01-22 09:53:01 -05:00

21 lines
368 B
C

/* converts a 15-bit BGR SNES style color to HTML #RRGGBB style */
#include <stdio.h>
int main(int argc, char **argv) {
int bgr,b,g,r,html;
fscanf(stdin,"%x",&bgr);
b=(bgr>>10)&0x1f;
g=(bgr>>5)&0x1f;
r=bgr&0x1f;
printf("rgb %x %x %x\n",r,g,b);
html=((r<<3)<<16)|((g<<3)<<8)|(b<<3);
printf("HTML: %x\n",html);
return 0;
}