Guest User

Untitled

a guest
May 25th, 2018
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. color HexString2color(char *hex)
  2. {
  3. color col;
  4. int rgb, alpha;
  5. char *end;
  6. if(hex[0] == '#')
  7. hex++;
  8. rgb = strtol(hex, &end, 16);
  9. if(end[0] == ':')
  10. alpha = strtol(end+1, NULL, 16);
  11. else
  12. alpha = 255;
  13.  
  14. gr_init_alphacolor(&col, rgb >> 16, (rgb >> 8) & 0xFF, rgb & 0xFF, alpha);
  15. return col;
  16. }
Add Comment
Please, Sign In to add comment