ObjFW
Loading...
Searching...
No Matches
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
23OF_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
91
100
109
118
128+ (OFColor *)grey OF_DEPRECATED(ObjFW, 1, 1, "Use +[gray] instead");
129
138
147
156
165
174
183
192
201
210
219
228
237
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
303OF_ASSUME_NONNULL_END
A class representing a color space.
Definition OFColorSpace.h:51
A class for storing a color.
Definition OFColor.h:31
OFColor * fuchsia()
Returns the HTML color fuchsia.
OFColor * red()
Returns the HTML color red.
OFColor * lime()
Returns the HTML color lime.
OFColor * blue()
Returns the HTML color blue.
OFColor * olive()
Returns the HTML color olive.
OFColor * aqua()
Returns the HTML color aqua.
OFColor * silver()
Returns the HTML color silver.
OFColor * navy()
Returns the HTML color navy.
OFColor * purple()
Returns the HTML color purple.
OFColor * grey()
Returns the HTML color gray.
Definition OFColor.m:141
OFColor * white()
Returns the HTML color white.
OFColor * gray()
Returns the HTML color gray.
OFColor * teal()
Returns the HTML color teal.
OFColor * green()
Returns the HTML color green.
OFColor * black()
Returns the HTML color black.
OFColor * yellow()
Returns the HTML color yellow.
OFColor * maroon()
Returns the HTML color maroon.
OFColorSpace * colorSpace
The color space in which the color is.
Definition OFColor.m:277
The root class for all other classes inside ObjFW.
Definition OFObject.h:956
instancetype retain()
Increases the retain count.