Below is a snippet of Objective-C code using the NSColor Class to set the background color of a textField.
Notice the color (a shade of blue) is set with float values for Red (0.1336), Green (0.5266), and Blue (1.0000). I opened Photoshop and I didn’t have much success finding a way to return RGB float values for displayed colors. I’m sure the feature is available. I’ll dig deeper when I have some time.
A while back I purchased a copy of iPalette Pro and tucked it away. This is a nifty design tool that supports custom color management and storage. It’s very well designed and fun to use. It’s another example of a $10 Mac Shareware gem.
Take a close look at the data located at the bottom of the RGB Test window. Exactly what I’m looking for: RGB float values.
I’m glad I bought iPalette Pro. It’s worth taking a look at …
NSColor, Cocoa, iPalette Pro
2 thoughts on “RGB Float Values with iPalette Pro …”
So what you’re trying to get is a decimal fraction.
If the maximum value is 255 then all you have to do is divide the value, say 34 by 255. In C the code, assuming a floating point variable named “red”, would be:
red = 34.0 / 255.0;
If your hard coding the values into the source code then just use your calculator.
Or you could buy the nice program for $10.
Thanks Rob. 😉
Comments are closed.