Guest User

Untitled

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