forked from RyanTech/Colours-for-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
UIColor+Colours.h
executable file
·231 lines (200 loc) · 5.53 KB
/
UIColor+Colours.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
//
// UIColor+Colours.h
// ColoursDemo
//
// Created by Jesper on 4/4/13.
// Copyright (c) 2013 Ben Gordon. All rights reserved.
//
#import <UIKit/UIKit.h>
// Color Scheme Creation Enum
typedef enum
{
ColorSchemeAnalagous = 0,
ColorSchemeMonochromatic,
ColorSchemeTriad,
ColorSchemeComplementary
} ColorScheme;
@interface UIColor (Colours)
#pragma mark - Color from Hex/RGBA/HSBA
/**
Creates a UIColor from a Hex representation string
@param hexString Hex string that looks like @"#FF0000" or @"FF0000"
@return UIColor
*/
+ (UIColor *)colorFromHexString:(NSString *)hexString;
/**
Creates a UIColor from an array of 4 NSNumbers (r,g,b,a)
@param rgbaArray 4 NSNumbers for rgba between 0 - 1
@return UIColor
*/
+ (UIColor *)colorFromRGBAArray:(NSArray *)rgbaArray;
/**
Creates a UIColor from a dictionary of 4 NSNumbers
Keys: @"r",@"g",@"b",@"a"
@param rgbaDictionary 4 NSNumbers for rgba between 0 - 1
@return UIColor
*/
+ (UIColor *)colorFromRGBADictionary:(NSDictionary *)rgbaDict;
/**
Creates a UIColor from an array of 4 NSNumbers (h,s,b,a)
@param hsbaArray 4 NSNumbers for rgba between 0 - 1
@return UIColor
*/
+ (UIColor *)colorFromHSBAArray:(NSArray *)hsbaArray;
/**
Creates a UIColor from a dictionary of 4 NSNumbers
Keys: @"h",@"s",@"b",@"a"
@param hsbaDictionary 4 NSNumbers for rgba between 0 - 1
@return UIColor
*/
+ (UIColor *)colorFromHSBADictionary:(NSDictionary *)hsbaDict;
#pragma mark - Hex/RGBA/HSBA from Color
/**
Creates a Hex representation from a UIColor
@return NSString
*/
- (NSString *)hexString;
/**
Creates an array of 4 NSNumbers representing the float values of r, g, b, a in that order.
@return NSArray
*/
- (NSArray *)rgbaArray;
/**
Creates an array of 4 NSNumbers representing the float values of h, s, b, a in that order.
@return NSArray
*/
- (NSArray *)hsbaArray;
/**
Creates a dictionary of 4 NSNumbers representing float values with keys: "r", "g", "b", "a"
@return NSDictionary
*/
- (NSDictionary *)rgbaDictionary;
/**
Creates a dictionary of 4 NSNumbers representing float values with keys: "h", "s", "b", "a"
@return NSDictionary
*/
- (NSDictionary *)hsbaDictionary;
#pragma mark - 4 Color Scheme from Color
/**
Creates an NSArray of 4 UIColors that complement the UIColor.
@param type ColorSchemeAnalagous, ColorSchemeMonochromatic, ColorSchemeTriad, ColorSchemeComplementary
@return NSArray
*/
- (NSArray *)colorSchemeOfType:(ColorScheme)type;
#pragma mark - Contrasting Color from Color
/**
Creates either [UIColor whiteColor] or [UIColor blackColor] depending on if the color this method is run on is dark or light.
@return UIColor
*/
- (UIColor *)blackOrWhiteContrastingColor;
#pragma mark - Colors
// System Colors
+ (UIColor *)infoBlueColor;
+ (UIColor *)successColor;
+ (UIColor *)warningColor;
+ (UIColor *)dangerColor;
// Whites
+ (UIColor *)antiqueWhiteColor;
+ (UIColor *)oldLaceColor;
+ (UIColor *)ivoryColor;
+ (UIColor *)seashellColor;
+ (UIColor *)ghostWhiteColor;
+ (UIColor *)snowColor;
+ (UIColor *)linenColor;
// Grays
+ (UIColor *)black25PercentColor;
+ (UIColor *)black50PercentColor;
+ (UIColor *)black75PercentColor;
+ (UIColor *)warmGrayColor;
+ (UIColor *)coolGrayColor;
+ (UIColor *)charcoalColor;
// Blues
+ (UIColor *)tealColor;
+ (UIColor *)steelBlueColor;
+ (UIColor *)robinEggColor;
+ (UIColor *)pastelBlueColor;
+ (UIColor *)turquoiseColor;
+ (UIColor *)skyBlueColor;
+ (UIColor *)indigoColor;
+ (UIColor *)denimColor;
+ (UIColor *)blueberryColor;
+ (UIColor *)cornflowerColor;
+ (UIColor *)babyBlueColor;
+ (UIColor *)midnightBlueColor;
+ (UIColor *)fadedBlueColor;
+ (UIColor *)icebergColor;
+ (UIColor *)waveColor;
// Greens
+ (UIColor *)emeraldColor;
+ (UIColor *)grassColor;
+ (UIColor *)pastelGreenColor;
+ (UIColor *)seafoamColor;
+ (UIColor *)paleGreenColor;
+ (UIColor *)cactusGreenColor;
+ (UIColor *)chartreuseColor;
+ (UIColor *)hollyGreenColor;
+ (UIColor *)oliveColor;
+ (UIColor *)oliveDrabColor;
+ (UIColor *)moneyGreenColor;
+ (UIColor *)honeydewColor;
+ (UIColor *)limeColor;
+ (UIColor *)cardTableColor;
// Reds
+ (UIColor *)salmonColor;
+ (UIColor *)brickRedColor;
+ (UIColor *)easterPinkColor;
+ (UIColor *)grapefruitColor;
+ (UIColor *)pinkColor;
+ (UIColor *)indianRedColor;
+ (UIColor *)strawberryColor;
+ (UIColor *)coralColor;
+ (UIColor *)maroonColor;
+ (UIColor *)watermelonColor;
+ (UIColor *)tomatoColor;
+ (UIColor *)pinkLipstickColor;
+ (UIColor *)paleRoseColor;
+ (UIColor *)crimsonColor;
// Purples
+ (UIColor *)eggplantColor;
+ (UIColor *)pastelPurpleColor;
+ (UIColor *)palePurpleColor;
+ (UIColor *)coolPurpleColor;
+ (UIColor *)violetColor;
+ (UIColor *)plumColor;
+ (UIColor *)lavenderColor;
+ (UIColor *)raspberryColor;
+ (UIColor *)fuschiaColor;
+ (UIColor *)grapeColor;
+ (UIColor *)periwinkleColor;
+ (UIColor *)orchidColor;
// Yellows
+ (UIColor *)goldenrodColor;
+ (UIColor *)yellowGreenColor;
+ (UIColor *)bananaColor;
+ (UIColor *)mustardColor;
+ (UIColor *)buttermilkColor;
+ (UIColor *)goldColor;
+ (UIColor *)creamColor;
+ (UIColor *)lightCreamColor;
+ (UIColor *)wheatColor;
+ (UIColor *)beigeColor;
// Oranges
+ (UIColor *)peachColor;
+ (UIColor *)burntOrangeColor;
+ (UIColor *)pastelOrangeColor;
+ (UIColor *)cantaloupeColor;
+ (UIColor *)carrotColor;
+ (UIColor *)mandarinColor;
// Browns
+ (UIColor *)chiliPowderColor;
+ (UIColor *)burntSiennaColor;
+ (UIColor *)chocolateColor;
+ (UIColor *)coffeeColor;
+ (UIColor *)cinnamonColor;
+ (UIColor *)almondColor;
+ (UIColor *)eggshellColor;
+ (UIColor *)sandColor;
+ (UIColor *)mudColor;
+ (UIColor *)siennaColor;
+ (UIColor *)dustColor;
@end