Skip to content

Commit

Permalink
Added the X11 colour palette.
Browse files Browse the repository at this point in the history
  • Loading branch information
NorthernRealities committed Mar 26, 2015
1 parent 2e554b9 commit d6b8e55
Show file tree
Hide file tree
Showing 3 changed files with 1,781 additions and 14 deletions.
6 changes: 4 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ To use the library download the file you want and import it into your project.

* __UIColor+Rainbow.swift__ - The complete palette of colours. If you import this one into your project don't use any others.
* __UIColor+RainbowCrayons.swift__ - A subset that only includes colours that are or have been Crayola colours.
* __UIColor+RainbowLight.swift__ - A subset that contains the more common colours. Please let me know if you think a colour should be in here.
* __UIColor+RainbowLight.swift__ - 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.
* __UIColor+RainbowX11.swift__ - 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.

If you can't find a colour in the library and you want to use the new color instance creation function add the file __UIColor+Creater.swift__ to your project. Then you can change your code from

Expand All @@ -41,12 +42,13 @@ In the meantime you can view the colours at Wikipedia where I got the data for a
* [List of Colors: G-M](https://en.wikipedia.org/wiki/List_of_colors:_G–M)
* [List of Colors: N-Z](https://en.wikipedia.org/wiki/List_of_colors:_N–Z)
* [List of Crayola Crayon Colors](https://en.wikipedia.org/wiki/List_of_Crayola_crayon_colors)
* [X11 Color Names](https://en.wikipedia.org/wiki/X11_color_names)

I also want to get the library so that it can be used with Mac applications. Right now it is only useful for iOS apps. Since I haven't built any apps for the Mac I don't know what needs to be done for the conversion. Any assistance would be appreciated.

## Contact

If you find a problem, want to suggest a colour, suggest how something that can be done differently, or even say hi you can reach me on [@NrthrnRealities](https://twitter.com/NrthrnRealities) on Twitter.
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](https://twitter.com/NrthrnRealities) on Twitter.

## A Note About Spelling

Expand Down
108 changes: 96 additions & 12 deletions UIColor+Rainbow.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5986,27 +5986,27 @@ extension UIColor {


/**
Returns a color object representing the color Green-Cyan, whose RBG values are (0, 153, 102), and has the specified opacity.
Returns a color object representing the color Green Yellow, whose RBG values are (173, 255, 47), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func greenCyanColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 0.0/255.0, green: 153.0/255.0, blue: 102.0/255.0, alpha: alpha ) }
class func greenYellowColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 173.0/255.0, green: 255.0/255.0, blue: 47.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Green-Yellow, whose RBG values are (173, 255, 47), and has the specified opacity.
Returns a color object representing the color Green-Cyan, whose RBG values are (0, 153, 102), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func greenYellowColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 173.0/255.0, green: 255.0/255.0, blue: 47.0/255.0, alpha: alpha ) }
class func greenCyanColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 0.0/255.0, green: 153.0/255.0, blue: 102.0/255.0, alpha: alpha ) }


/**
Expand Down Expand Up @@ -6813,6 +6813,18 @@ extension UIColor {
return UIColor.init ( red: 58.0/255.0, green: 176.0/255.0, blue: 158.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Khaki, whose RBG values are (189, 183, 107), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func khakiColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 189.0/255.0, green: 183.0/255.0, blue: 107.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Khaki (X11) (Light Khaki), whose RBG values are (240, 230, 140), and has the specified opacity.

Expand Down Expand Up @@ -8877,6 +8889,18 @@ extension UIColor {
return UIColor.init ( red: 0.0/255.0, green: 0.0/255.0, blue: 128.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Navy Blue, whose RBG values are (0, 0, 128), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func navyBlueColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 0.0/255.0, green: 0.0/255.0, blue: 128.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Navy Blue (Crayola), whose RBG values are (25, 116, 210), and has the specified opacity.

Expand Down Expand Up @@ -12369,6 +12393,18 @@ extension UIColor {
return UIColor.init ( red: 136.0/255.0, green: 45.0/255.0, blue: 23.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Sienna (X11), whose RBG values are (160, 82, 45), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func siennaX11Color ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 160.0/255.0, green: 82.0/255.0, blue: 45.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Silver, whose RBG values are (192, 192, 192), and has the specified opacity.

Expand Down Expand Up @@ -14541,6 +14577,54 @@ extension UIColor {
return UIColor.init ( red: 164.0/255.0, green: 244.0/255.0, blue: 249.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Web Gray, whose RBG values are (128, 128, 128), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func webGrayColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 128.0/255.0, green: 128.0/255.0, blue: 128.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Web Green, whose RBG values are (0, 128, 0), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func webGreenColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 0.0/255.0, green: 128.0/255.0, blue: 0.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Web Maroon, whose RBG values are (127, 0, 0), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func webMaroonColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 127.0/255.0, green: 0.0/255.0, blue: 0.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Web Purple, whose RBG values are (127, 0, 127), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func webPurpleColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 127.0/255.0, green: 0.0/255.0, blue: 127.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Wenge, whose RBG values are (100, 84, 82), and has the specified opacity.

Expand Down Expand Up @@ -14842,27 +14926,27 @@ extension UIColor {


/**
Returns a color object representing the color Yellow Rose, whose RBG values are (255, 240, 0), and has the specified opacity.
Returns a color object representing the color Yellow Green, whose RBG values are (154, 205, 50), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func yellowRoseColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 255.0/255.0, green: 240.0/255.0, blue: 0.0/255.0, alpha: alpha ) }
class func yellowGreenColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 154.0/255.0, green: 205.0/255.0, blue: 50.0/255.0, alpha: alpha ) }


/**
Returns a color object representing the color Yellow-Green, whose RBG values are (154, 205, 50), and has the specified opacity.
Returns a color object representing the color Yellow Rose, whose RBG values are (255, 240, 0), and has the specified opacity.

:param: alpha A CGFloat between 0.0 and 1.0 representing the opacity with a default value of 1.0.

:returns: The UIColor object
*/

class func yellowGreenColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 154.0/255.0, green: 205.0/255.0, blue: 50.0/255.0, alpha: alpha ) }
class func yellowRoseColor ( alpha: CGFloat = 1.0 ) -> UIColor {
return UIColor.init ( red: 255.0/255.0, green: 240.0/255.0, blue: 0.0/255.0, alpha: alpha ) }


/**
Expand Down
Loading

0 comments on commit d6b8e55

Please sign in to comment.