ObjFW
OFColor.h
1 /*
2  * Copyright (c) 2008-2026 Jonathan Schleifer <js@nil.im>
3  *
4  * All rights reserved.
5  *
6  * This program is free software: you can redistribute it and/or modify it
7  * under the terms of the GNU Lesser General Public License version 3.0 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
13  * version 3.0 for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * version 3.0 along with this program. If not, see
17  * <https://www.gnu.org/licenses/>.
18  */
19 
20 #import "OFObject.h"
21 #import "OFColorSpace.h"
22 
23 OF_ASSUME_NONNULL_BEGIN
24 
30 @interface OFColor: OFObject
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 *gray;
35 @property (class, readonly, nonatomic) OFColor *grey
36  OF_DEPRECATED(ObjFW, 1, 1, "Use +[gray] instead");
37 @property (class, readonly, nonatomic) OFColor *white;
38 @property (class, readonly, nonatomic) OFColor *maroon;
39 @property (class, readonly, nonatomic) OFColor *red;
40 @property (class, readonly, nonatomic) OFColor *purple;
41 @property (class, readonly, nonatomic) OFColor *fuchsia;
42 @property (class, readonly, nonatomic) OFColor *green;
43 @property (class, readonly, nonatomic) OFColor *lime;
44 @property (class, readonly, nonatomic) OFColor *olive;
45 @property (class, readonly, nonatomic) OFColor *yellow;
46 @property (class, readonly, nonatomic) OFColor *navy;
47 @property (class, readonly, nonatomic) OFColor *blue;
48 @property (class, readonly, nonatomic) OFColor *teal;
49 @property (class, readonly, nonatomic) OFColor *aqua;
50 #endif
51 
58 @property (readonly, retain, nonatomic) OFColorSpace *colorSpace;
59 
70 + (instancetype)colorWithRed: (float)red
71  green: (float)green
72  blue: (float)blue
73  alpha: (float)alpha;
74 
86 + (instancetype)colorWithRed: (float)red
87  green: (float)green
88  blue: (float)blue
89  alpha: (float)alpha
90  colorSpace: (OFColorSpace *)colorSpace;
91 
99 + (OFColor *)black;
100 
108 + (OFColor *)silver;
109 
117 + (OFColor *)gray;
118 
128 + (OFColor *)grey OF_DEPRECATED(ObjFW, 1, 1, "Use +[gray] instead");
129 
137 + (OFColor *)white;
138 
146 + (OFColor *)maroon;
147 
155 + (OFColor *)red;
156 
164 + (OFColor *)purple;
165 
173 + (OFColor *)fuchsia;
174 
182 + (OFColor *)green;
183 
191 + (OFColor *)lime;
192 
200 + (OFColor *)olive;
201 
209 + (OFColor *)yellow;
210 
218 + (OFColor *)navy;
219 
227 + (OFColor *)blue;
228 
236 + (OFColor *)teal;
237 
245 + (OFColor *)aqua;
246 
258 - (instancetype)initWithRed: (float)red
259  green: (float)green
260  blue: (float)blue
261  alpha: (float)alpha;
262 
275 - (instancetype)initWithRed: (float)red
276  green: (float)green
277  blue: (float)blue
278  alpha: (float)alpha
279  colorSpace: (OFColorSpace *)colorSpace;
280 
289 - (void)getRed: (float *)red
290  green: (float *)green
291  blue: (float *)blue
292  alpha: (nullable float *)alpha;
293 
300 - (OFColor *)colorUsingColorSpace: (OFColorSpace *)colorSpace;
301 @end
302 
303 OF_ASSUME_NONNULL_END
OFColor * gray()
Returns the HTML color gray.
OFColor * lime()
Returns the HTML color lime.
OFColor * grey()
Returns the HTML color gray.
Definition: OFColor.m:141
A class for storing a color.
Definition: OFColor.h:30
The root class for all other classes inside ObjFW.
Definition: OFObject.h:954
OFColor * silver()
Returns the HTML color silver.
OFColor * maroon()
Returns the HTML color maroon.
instancetype retain()
Increases the retain count.
OFColorSpace * colorSpace
The color space in which the color is.
Definition: OFColor.h:58
OFColor * teal()
Returns the HTML color teal.
OFColor * black()
Returns the HTML color black.
OFColor * olive()
Returns the HTML color olive.
OFColor * white()
Returns the HTML color white.
OFColor * navy()
Returns the HTML color navy.
OFColor * red()
Returns the HTML color red.
OFColor * yellow()
Returns the HTML color yellow.
OFColor * aqua()
Returns the HTML color aqua.
OFColor * green()
Returns the HTML color green.
A class representing a color space.
Definition: OFColorSpace.h:50
OFColor * purple()
Returns the HTML color purple.
OFColor * blue()
Returns the HTML color blue.
OFColor * fuchsia()
Returns the HTML color fuchsia.