Latest 0.1.1
Homepage https://github.com/thirteen23/T23Kit-Colour
License MIT
Platforms ios 7.0
Frameworks UIKit
Authors

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:

Using CocoaPods:
  1. Add the pod T23Kit-Colour to your Podfile.

pod 'T23Kit-Colour'

  1. Run pod install from Terminal, then open your app’s .xcworkspace file to launch Xcode.
  2. #import "UIColor+T23ColourSpaces.h" wherever you want to use the API.
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:

Using CocoaPods:

CocoaPods aren’t supported yet but this project will update as soon as CocoaPods irons it all out.

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.

Latest podspec

{
    "name": "T23Kit-Colour",
    "version": "0.1.1",
    "summary": "UIColor Category with various colourspace transformations and u2206-E methods.",
    "description": "                  UIColor category with support for non-standard colorspace conversions from RGB, neighbour colour generation methods, and colour distance methods.n",
    "homepage": "https://github.com/thirteen23/T23Kit-Colour",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Michael Van Milligan": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/thirteen23/T23Kit-Colour.git",
        "tag": "0.1.1"
    },
    "source_files": "T23Kit-Colour/ObjC/{Categories,libcolourspaces}/*.{h,m,c}",
    "public_header_files": "T23Kit-Colour/ObjC/{Categories,libcolourspaces}/*.h",
    "frameworks": "UIKit",
    "requires_arc": false
}

Pin It on Pinterest

Share This