Tag: colors

Comparing colors in Objective-C

I’m trying to determine if two colors are equivalent, using code written in Objective-C. I’m using this snippet of code to determine if the two colors are equivalent (currently for debugging purposes) NSLog(@”currentColor is %@”, currentColor); NSLog(@”Adjacent Color is %@”,[[buttonArray objectAtIndex:1] backgroundColor]); NSLog(@”%i”,[[buttonArray objectAtIndex:1] backgroundColor]==currentColor); My console is showing 2009-10-20 00:27:10.814 colorGame[13588:207] currentColor is kCGColorSpaceModelRGB […]

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 […]

Adding Colours (Colors) Together like Paint (Blue + Yellow = Green, etc)

I’m making an iOS game using cocos2d libraries. Lets say you have two objects that have two separate colours – defined in RGB as Blue: 0,0,255 Yellow: 255,255,0 I want to add blue and yellow to make green. To over complicate things, let’s say that the Blue object is bigger than the Yellow object (for […]

Get the color a pixel on the screen in objective-c cocoa app

I am trying to create a color picker cocoa app in objective-c so I can get the color of any pixel on my screen. Is there a way to get the color a certain screen pixel in objective-c?

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 […]

How to define colors in XCodes' Interface Builder?

I would like to copy colors between elements in the Interface Builder or define them using RGB values. For example, I’d like to copy the background color of a button to another button without duplicating the button. Alternatively, entering exact RGB codes in Interface Builder would suffice; that way I can make sure my buttons […]

UIView backgroundColor color cycle

First of all, I am new to this Xcode/Objective-C thing, so go easy on me! 🙂 I made a test app that, by pressing some buttons, the background changes. I have a red, blue, green, white, black and revive button. I made the app change the color of the backgrnd by pressing all the color […]

How To Change Tab bar color in Xcode

How do I go about changing the tab bar color in this code? My tab bar is black. On click changes it to blue. I want to change the tow color to any other color. This code is from :application.m and there :rotatingTabBarController.m ,rotatingTabBarController.h // 1B) If this app uses tabs, create a tabbed navigation […]

Is there a way color-code the iPhone Debugger Console display in Xcode?

I observed Android programmers using LogCat to see colored Debugger Console output. It looks like you can have different classes do their debug output in different colors. Is this possible when developing for iPhone?

How to create Named colors in Interface Builder?

How do I setup & use custom named colors in Interface Builder?