mirror of
https://github.com/deater/tb1.git
synced 2024-06-07 20:29:31 +00:00
dbaf404ec3
I kept typing it wrong anyway, and hey, git makes rename easy
21 lines
368 B
C
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;
|
|
}
|