ObjFW
OFColor.h
1 /*
2  * Copyright (c) 2008-2021 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This file is part of ObjFW. It may be distributed under the terms of the
7  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
8  * the packaging of this file.
9  *
10  * Alternatively, it may be distributed under the terms of the GNU General
11  * Public License, either version 2 or 3, which can be found in the file
12  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
13  * file.
14  */
15 
16 #import "OFObject.h"
17 
18 OF_ASSUME_NONNULL_BEGIN
19 
25 @interface OFColor: OFObject
26 {
27  float _red, _green, _blue, _alpha;
28  OF_RESERVE_IVARS(OFColor, 4)
29 }
30 
31 #ifdef OF_HAVE_CLASS_PROPERTIES
32 @property (class, readonly, nonatomic) OFColor *black;
33 @property (class, readonly, nonatomic) OFColor *silver;
34 @property (class, readonly, nonatomic) OFColor *grey;
35 @property (class, readonly, nonatomic) OFColor *white;
36 @property (class, readonly, nonatomic) OFColor *maroon;
37 @property (class, readonly, nonatomic) OFColor *red;
38 @property (class, readonly, nonatomic) OFColor *purple;
39 @property (class, readonly, nonatomic) OFColor *fuchsia;
40 @property (class, readonly, nonatomic) OFColor *green;
41 @property (class, readonly, nonatomic) OFColor *lime;
42 @property (class, readonly, nonatomic) OFColor *olive;
43 @property (class, readonly, nonatomic) OFColor *yellow;
44 @property (class, readonly, nonatomic) OFColor *navy;
45 @property (class, readonly, nonatomic) OFColor *blue;
46 @property (class, readonly, nonatomic) OFColor *teal;
47 @property (class, readonly, nonatomic) OFColor *aqua;
48 #endif
49 
60 + (instancetype)colorWithRed: (float)red
61  green: (float)green
62  blue: (float)blue
63  alpha: (float)alpha;
64 
72 + (OFColor *)black;
73 
81 + (OFColor *)silver;
82 
90 + (OFColor *)grey;
91 
99 + (OFColor *)white;
100 
108 + (OFColor *)maroon;
109 
117 + (OFColor *)red;
118 
126 + (OFColor *)purple;
127 
135 + (OFColor *)fuchsia;
136 
144 + (OFColor *)green;
145 
153 + (OFColor *)lime;
154 
162 + (OFColor *)olive;
163 
171 + (OFColor *)yellow;
172 
180 + (OFColor *)navy;
181 
189 + (OFColor *)blue;
190 
198 + (OFColor *)teal;
199 
207 + (OFColor *)aqua;
208 
220 - (instancetype)initWithRed: (float)red
221  green: (float)green
222  blue: (float)blue
223  alpha: (float)alpha;
224 
233 - (void)getRed: (float *)red
234  green: (float *)green
235  blue: (float *)blue
236  alpha: (nullable float *)alpha;
237 @end
238 
239 OF_ASSUME_NONNULL_END
A class for storing a color.
Definition: OFColor.h:26
The root class for all other classes inside ObjFW.
Definition: OFObject.h:520