Hi,
I am currently making a plugin, and it uses HEX values for color (It goes on the internet.)
The code I am using looks like this:
Problem is the user can use CKMY,grayscale... etc... how do I convert these to Hex? Or only allow hex?
I am currently making a plugin, and it uses HEX values for color (It goes on the internet.)
The code I am using looks like this:
Code:
NSColor *myColor = [userColor color];
float redPart = [myColor redComponent];
float greenPart = [myColor greenComponent];
float bluePart = [myColor blueComponent];
int redHexString = redPart * 255;
int greenHexString = greenPart * 255;
int blueHexString = bluePart * 255;
NSString *rgbHexString = [NSString stringWithFormat:@"0x%.2x%.2x%.2x", redHexString, greenHexString, blueHexString];
NSString *rgbString = [NSString stringWithFormat:@"%.2x%.2x%.2x", redHexString, greenHexString, blueHexString];