-
Notifications
You must be signed in to change notification settings - Fork 3
/
BNColor.h
60 lines (46 loc) · 1.26 KB
/
BNColor.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
//
// BNColor.h
//
// Created by Tyler Neylon on 11/25/09.
// Copyleft 2009 Bynomial.
//
// BNColor is a Bynomial Color class, meant to make
// it easier to deal interchangably with both
// RGB and HSV color models.
//
#import <Foundation/Foundation.h>
@interface BNColor : NSObject <NSCopying, NSCoding> {
float red;
float green;
float blue;
}
// All of these values are in the range [0,1].
@property (nonatomic) float red;
@property (nonatomic) float green;
@property (nonatomic) float blue;
@property (nonatomic) float hue;
@property (nonatomic) float saturation;
@property (nonatomic) float value;
+ (BNColor *)colorWithRed:(CGFloat)red green:(CGFloat)green blue:(CGFloat)blue;
- (void)setWithHue:(float)h saturation:(float)s value:(float)v;
- (void)setFill;
- (void)setStroke;
- (UIColor *)colorFromBNColor;
- (NSString *)hexCode;
- (NSString *)decString;
- (NSString *)percentString;
// Named colors, for convenience.
+ (BNColor *)redColor;
+ (BNColor *)orangeColor;
+ (BNColor *)yellowColor;
+ (BNColor *)greenColor;
+ (BNColor *)blueColor;
+ (BNColor *)purpleColor;
+ (BNColor *)magentaColor;
+ (BNColor *)cyanColor;
+ (BNColor *)brownColor;
+ (BNColor *)blackColor;
+ (BNColor *)darkGrayColor;
+ (BNColor *)lightGrayColor;
+ (BNColor *)whiteColor;
@end