Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- color HexString2color(char *hex)
- {
- color col;
- int rgb, alpha;
- char *end;
- if(hex[0] == '#')
- hex++;
- rgb = strtol(hex, &end, 16);
- if(end[0] == ':')
- alpha = strtol(end+1, NULL, 16);
- else
- alpha = 255;
- gr_init_alphacolor(&col, rgb >> 16, (rgb >> 8) & 0xFF, rgb & 0xFF, alpha);
- return col;
- }
Add Comment
Please, Sign In to add comment