Latest 0.0.3
Homepage https://github.com/mysterioustrousers/MTColorDistance
License MIT
Platforms ios
Frameworks UIKit
Authors ,

A category on UIColor. Pass in an array of colors and it will return the closest color to the receiver.

Installation

In your Podfile, add this line:

pod "MTColorDistance"

pod? => https://github.com/CocoaPods/CocoaPods/

NOTE: You may need to add -all_load to "Other Linker Flags" in your targets build settings if the pods library only contains categories.

Example Usage

UIColor *red    = [UIColor redColor];
UIColor *redish = [UIColor colorWithRed:0.9 green:0 blue:0 alpha:1];
NSArray *palette = @[redish, [UIColor blueColor], [UIColor whiteColor], [UIColor greenColor]];

UIColor *closestToRed = [red closestColorInPalette:palette];

You guessed it, redish will be returned.

Latest podspec

{
    "name": "MTColorDistance",
    "version": "0.0.3",
    "summary": "A category on UIColor. Pass in an array of colors and it will return the closest color to the receiver.",
    "homepage": "https://github.com/mysterioustrousers/MTColorDistance",
    "license": "MIT",
    "authors": {
        "Quenton Jones": "[email protected]",
        "Adam Kirk": "[email protected]"
    },
    "source": {
        "git": "https://github.com/mysterioustrousers/MTColorDistance.git",
        "tag": "0.0.3"
    },
    "platforms": {
        "ios": null
    },
    "source_files": "MTColorDistance/*.{h,m}",
    "frameworks": "UIKit",
    "requires_arc": false
}

Pin It on Pinterest

Share This