T23Kit-Colour 0.1.1

T23Kit-Colour 0.1.1

TestsTested
LangLanguage CC
License MIT
ReleasedLast Release Feb 2015

Maintained by Michael Van Milligan.



  • By
  • Michael Van Milligan

UIColor Category with various colourspace transformations, neighbourhood colour generations, and ∆-E metrics.


Discussion

Currently there are three pieces to this library:

  1. UIColor conversions to non-standard colour spaces
  2. UIColor neighbourhood colour generations
  3. UIColor distance (∆-E) metrics

Colour Conversions

Below are the currently supported colourspace conversions:

  • RYB (Only from RYB)
  • CIE XYZ 1
  • Hunter 1948 (L, a, b)
  • CIE 1976 (L*, a*, b*)
  • CIE 1976 (L*, u*, v*)
  • CIE 1976 (L*, C*, H*ab)
  • CIE 1976 (L*, C*, H*uv)
  • CMYK
  • HSL
  • HSI

Note: Please see UIColor+T23ColourSpaces.h for the format of values that are returned.

1 The default currently uses the sRGB working matrices for converting to/from XYZ space. Please see rgb_working_matrices in colourspaces.c for more detail

Neighbourhood Colour Generations

Below are the currently supported neighbourhood generations

  • Triadic
  • Split Complements
  • Analogous
  • Complementary

Note: Please see EasyRGB's definition of these neighbourhoods.

Colour Distance Formulas (∆-E)

Below are the currently supported colour distance metrics

  • CIE76
  • CIE94
  • CIEDE2000
  • CMC l:c (1984)

Note: Please see Wikipedia for more information regarding ∆-E


API

UIColor+T23ColourSpaces

+ (UIColor *)colorWithRed:yellow:blue:alpha:
+ (UIColor *)colorWithHexString:alpha:
- (UIColor *)initWithRed:yellow:blue:alpha:
- (UIColor *)initWithHexString:alpha:
- (NSString *)hexString
- (BOOL)getX:Y:Z:alpha:
- (BOOL)getHunterLStar:aStar:bStar:alpha:
- (BOOL)getLStar:aStar:bStar:alpha:
- (BOOL)getLStar:uStar:vStar:alpha:
- (BOOL)getLStar:cStar:hStarAB:alpha:
- (BOOL)getLStar:cStar:hStarUV:alpha:
- (BOOL)getCyan:magenta:yellow:black:alpha:
- (BOOL)getHue:saturation:lightness:alpha:
- (BOOL)getHue:saturation:intensity:alpha:
- (NSArray *)getTriadic
- (NSArray *)getSplitComplements
- (NSArray *)getAnalogous
- (UIColor *)getComplement
- (CGFloat)getDistanceMetricBetweenUIColor:withOptions:

UIColor Swift Extension

- init(red: CGFloat, yellow: CGFloat, blue: CGFloat, alpha: CGFloat)
- init(hexString: String, alpha: CGFloat)
- var hue:CGFloat { get }
- var saturation:CGFloat { get }
- var brightness:CGFloat { get }
- var red:CGFloat { get }
- var green:CGFloat { get }
- var blue:CGFloat { get }
- var alpha:CGFloat { get }
- var hexString:String { get }
- func getHSB() -> HSB
- func getRGB() -> RGB
- func getXYZ() -> XYZ
- func getHLAB() -> HLAB
- func getLAB() -> LAB
- func getLUV() -> LUV
- func getLCHab() -> LCHab
- func getLCHuv() -> LCHuv
- func getCMYK() -> CMYK
- func getHSI() -> HSI
- func getHSL() -> HSL
- func getTriadic() -> (thisColor: UIColor, right: UIColor, left: UIColor)
- func getSplitCompliments() -> (thisColor: UIColor, right: UIColor, left: UIColor)
- func getAnalogous() -> (thisColor: UIColor, right: UIColor, left: UIColor)
- func getCompliment() -> UIColor
- func getDistanceBetweenUIColor(compare: UIColor, options: ColourDistanceOptions) -> CGFloat

Setup

Objective-C:

Manually from GitHub
  1. Download the source files in the T23Kit-Colour Source directory.
  2. Add files to your Xcode project.
  3. #import "UIColor+T23ColourSpaces.h" wherever you want to use the API.

Swift:

Manually from GitHub
  1. Download the source files in the T23Kit-Colour Source directory.
  2. Add Colour.swift to your Xcode project.

Examples

If you would like to see an example of this library in use check out our other toy project ColorPalette.

Releases

Releases are tagged in the git commit history using (mostly) semantic versioning. Check out the releases and release notes for each version.

Designed & maintained by Thirteen23 Developers. Distributed with the MIT license.