Tag: rgb

Objective-C RGB to HSB

Let’s say I’ve got the colour FF0000, which is red. Finding a darker colour is easy, I just type maybe CC instead of the FF, but let’s say I’ve got the colour AE83FC, which is a complicated colour, how the heck would I find a lighter or darker version of it automatically? I figured the […]

UIColor CMYK and Lab Values?

I have been trawling the web for a solution but have managed to find one which works yet. Simple question, more than likely complex answer: How can I get CMYK and Lab values from a UIColor object (of which i know the RGB values if it helps)? I have found this regarding getting CMYK values […]

Converting from RGB to HSL with Objective C

I’m quite new to objective c but have been programming for a while. I started creating a function that would convert from RGB to HSL and back again but I get a feeling it is way too long and headed in the wrong direction. Does anyone know of a simple way to perform this conversion?

How can I convert RGB hex string into UIColor in objective-c?

I have color values coming from the url data is like this, “#ff33cc”. How can I convert this value into UIColor? I am attempting with the following lines of code. I am not getting the value for baseColor1 right. Looks like I should take that pound char off. Is there another way to do it? […]

Shift hue of an RGB Color

I’m trying to write a function to shift the hue of an RGB color. Specifically I’m using it in an iOS app, but the math is universal. The graph below shows how the R, G, and B values change with respect to the hue. Looking at that it seems like it should be a relatively […]

Converting RGB data into a bitmap in Objective-C++ Cocoa

I have a buffer of RGB unsigned char that I would like converted into a bitmap file, does anyone know how? My RGB float is of the following format R [(0,0)], G[(0,0)], B[(0,0)],R [(0,1)], G[(0,1)], B[(0,1)], R [(0,2)], G[(0,2)], B[(0,2)] ….. The values for each data unit ranges from 0 to 255. anyone has any […]

Create image from RGB data?

I’m having real trouble with this. I have some raw rgb data, values from 0 to 255, and want to display it as an image on the iphone but can’t find out how to do it. Can anyone help? I think i might need to use CGImageCreate but just don’t get it. Tried looking at […]

Color detection at a distance (Swift)

Can someone point me in the right direction with color detection at a distance? I have used the code below and it grabs RBG values of an image properly if an object or point of interest is less than 10 feet away. When the object is at a distance the code returns the wrong values. […]

How do I pick the color in hexadecimal form or RGB form instead of using the colors given to me in Swift

This question already has an answer here: How to use hex colour values 28 answers

How to get the RGB Code (INT) from an UIColor in Swift

I would like to get the RGB Value of an UIColor in Swift: let swiftColor = UIColor(red: 1, green: 165/255, blue: 0, alpha: 1) println(“RGB Value is:”); println(swiftColor.getRGB()); <<<<<< How to do that ? In Java I would do it as follows: Color cnew = new Color(); int iColor = cnew.rgb(1, 165/255, 0); System.out.println(iColor); How […]