The function of the Rainbow NSColor extension is to provide developers with more colour choices within their applications. Apple provides a limited number of pre-defined colours such as NSColor.blackColor() and NSColor.greenColor(). This library adds over 1200 more colours to be used. I think it makes code much easier to read and much more understandable when someone comes across
cell.backgroundColor = [ NSColor antiqueWhiteColorWithAlpha: 1.0 ];
versus having to use the RGB values
cell.backgroundColor = [ NSColor colorWithRed: 250.0/255.0 green: 235.0/255.0 blue: 215.0/255.0 alpha: 1.0 ];
If you want to use an opacity value (alpha) of 1.0 then there is a short form of the functions availble that let's you not specify the alpha value. It uses a default value of 1.0. So the above code could be written as
cell.backgroundColor = [ NSColor antiqueWhiteColor ];
Except for some obvious cases I'm not very good at looking at RGB values and determining what they will display.
To use the library download the files you want and import them into your project. If you don't want all of colours then choose one of the subsets. I will try to make sure that multiple subsets can be used together. If you encounter a problem please let me know.
- NSColor+Rainbow.[hm] - The complete palette of colours. If you import this one into your project don't use any others.
- NSColor+RainbowCrayons.[hm] - A subset that only includes colours that are or have been Crayola colours.
- NSColor+RainbowGoogleDesign.[hm] - A subset that contains the colours from the Google design guidelines. (Also known as their Material UI Colors.)
- NSColor+RainbowLight.[hm] - A subset that contains the more common colours. Please let me know if you think a colour should be in here. This palette is one that I am choosing the colours for on my own.
- NSColor+RainbowX11.[hm] - A palette that contains a subset which are the defined X11 colours. They are also known as the web colours because all of the browsers define them along with the 16 colours defined in the HTML spec. I've created this subset because I figured that it's probably a nice light-weight and balanced palette to make available.
In the short term I hope to release an app that will let you view the colours and perform searching. In the longer term I want to add more colours to the library, either individually or through collections. Ideally it would be great to get one or more of the paint manufacturers to give their permission to use their their palette. I know that Pantone would achive the same thing but it would cost money to get the information and they would probably be opposed to it being publicly posted. All information for the colours was obtained from Wikipedia. I cleaned up any broken links or incorrect information that I came across while working on this project. If you contribute a colour to the library please also let me know if I can add it to the list of colours on Wikipedia.
In the meantime you can view the colours at Wikipedia where I got the data for all of the colours at the pages.
- List of Colors: A-F
- List of Colors: G-M
- List of Colors: N-Z
- List of Crayola Crayon Colors
- X11 Color Names
- Color - Style - Google Design Guidelines
If you find a problem, want to suggest a colour (or know someone I could approach about asking to use their colour set), suggest how something that can be done differently, or even say hi you can reach me on @NrthrnRealities on Twitter.
I am terribly sorry about mixing up the spellings of colour and color. I'm from Canada and we spell it with the 'u' and I can't get out of the habit. However when it comes to function names, parameters, and other cases when it really counts I've strived to go against my instincts and spelt it without the extra letter as per the Apple standard. In other cases I've allowed myself to spell it the proper way. :) Please forgive me my little indulgence.