I’m reading hex colors from a JSON file, but need to get them as an int so I can create a color.
int col=Integer.parseInt("FF0000",16);
returns 16711680
int c = unhex("FF0000");
returns 16711680
how do I do this?
Advertisement
Answer
What I did was simply recreated the color like this:
int c = Integer.parseInt(obj.getString("color"), 16); c = color(red(c), green(c), blue(c));