Skip to content
This repository has been archived by the owner on Jun 13, 2021. It is now read-only.

Commit

Permalink
Updated a method
Browse files Browse the repository at this point in the history
  • Loading branch information
Vicc Alexander committed Jan 28, 2015
1 parent dec4fd8 commit 147b667
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
15 changes: 15 additions & 0 deletions Chameleon/NSArray+Chameleon.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,19 @@ typedef NS_ENUM (NSInteger, ColorScheme) {
*/
+ (NSArray *)arrayOfColorsWithColorScheme:(ColorScheme)colorScheme with:(UIColor *)color flatScheme:(BOOL)isFlatScheme;

#pragma mark - Chameleon Deprecated Methods as of 1.1.2

/**
* Generates and creates an array of 5 color objects in the HSB colorspace from the specified color.
*
* @param colorScheme The color scheme with which to select colors using a specified color.
* @param color The specified color which the color scheme is built around.
* @param isFlatScheme Pass YES to return flat color objects.
*
* @deprecated
*
* @return An array of 5 color objects in the HSB colorspace.
*/
+ (NSArray *)arrayOfColorsWithColorScheme:(ColorScheme)colorScheme for:(UIColor *)color flatScheme:(BOOL)isFlatScheme __attribute((deprecated(" Use -arrayOfColorsWithColorScheme:with:flatScheme: instead (First deprecated in Chameleon 1.1.2).")));

@end
31 changes: 31 additions & 0 deletions Chameleon/NSArray+Chameleon.m
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,37 @@ @implementation NSArray (Chameleon)

#pragma mark - Chameleon - Public Color Scheme Methods

/*
Deprecated as of version 1.1.2 Please use the method below this one.
*/

+ (NSArray *)arrayOfColorsWithColorScheme:(ColorScheme)colorScheme for:(UIColor *)color flatScheme:(BOOL)isFlatScheme {

//Extract HSB values from input color
CGFloat h, s, b, a;
[color getHue:&h saturation:&s brightness:&b alpha:&a];

//Multiply our values by the max value to convert
h *= 360;
s *= 100;
b *= 100;

//Choose Between Schemes
switch (colorScheme) {
case ColorSchemeAnalogous:
if (isFlatScheme) return [self analogousColorSchemeFromHue:h Saturation:s Brightness:b flat:YES];
else return [self analogousColorSchemeFromHue:h Saturation:s Brightness:b flat:NO];
case ColorSchemeComplementary:
if (isFlatScheme) return [self complementaryColorSchemeFromHue:h Saturation:s Brightness:b flat:YES];
else return [self complementaryColorSchemeFromHue:h Saturation:s Brightness:b flat:NO];
case ColorSchemeTriadic:
if (isFlatScheme) return [self triadicColorSchemeFromHue:h Saturation:s Brightness:b flat:YES];
else return [self triadicColorSchemeFromHue:h Saturation:s Brightness:b flat:NO];
default:
NSAssert(0, @"Oops! Unrecognized color scheme provided as random color.");
}
}

+ (NSArray *)arrayOfColorsWithColorScheme:(ColorScheme)colorScheme with:(UIColor *)color flatScheme:(BOOL)isFlatScheme {

//Extract HSB values from input color
Expand Down
Binary file not shown.

0 comments on commit 147b667

Please sign in to comment.