AI-generated Key Takeaways
-
GCKColor is a class that represents an RGBA color and inherits from NSObject, <NSCopying>, and <NSSecureCoding>.
-
You can initialize a GCKColor object with red, green, blue, and alpha values, or from a UIColor, CGColor, or CSS string.
-
Instance methods include initializers and a method to return a CSS string representation of the color.
-
Class methods provide predefined GCKColor objects for common colors like black, red, green, and blue.
-
The properties of a GCKColor object are the red, green, blue, and alpha intensity values, which are in the range [0.0, 1.0].
Overview
A class that represents an RGBA color.
Inherits NSObject, <NSCopying>, and <NSSecureCoding>.
Method Detail
| - (instancetype) initWithRed: | (CGFloat) | red | |
| green: | (CGFloat) | green | |
| blue: | (CGFloat) | blue | |
| alpha: | (CGFloat) | alpha | |
Designated initializer.
Constructs a GCKColor object with the given red, green, blue, and alpha values. All color components are in the range [0.0, 1.0].
| - (instancetype) initWithRed: | (CGFloat) | red | |
| green: | (CGFloat) | green | |
| blue: | (CGFloat) | blue | |
Constructs a GCKColor object with the given red, green, blue values and an alpha value of 1.0 (full opacity).
All color components are in the range [0.0, 1.0].
| - (instancetype) initWithUIColor: | (UIColor *) | color |
Constructs a GCKColor object from a UIColor.
| - (instancetype) initWithCGColor: | (CGColorRef) | color |
Constructs a GCKColor object from a CGColor.
| - (instancetype) initWithCGColor: | (CGColorRef) | color | |
| alpha: | (CGFloat) | alpha | |
Constructs a GCKColor object from a CGColor and a given alpha value.
- Since
- 4.0
| - (instancetype) initWithCSSString: | (NSString *) | CSSString |
Constructs a GCKColor object from a CSS string representation in the form "#RRGGBBAA" or "#RRGGBB".
| - (NSString *) CSSString |
Returns a CSS string representation of the color, in the form "#RRGGBBAA".
| + ( GCKColor *) black |
The color black.
| + ( GCKColor *) red |
The color red.
| + ( GCKColor *) green |
The color green.
| + ( GCKColor *) blue |
The color blue.
| + ( GCKColor *) cyan |
The color cyan.
| + ( GCKColor *) magenta |
The color magenta.
| + ( GCKColor *) yellow |
The color yellow.
| + ( GCKColor *) white |
The color white.
Property Detail
The red intensity of the color; a value in the range [0.0, 1.0].
The green intensity of the color; a value in the range [0.0, 1.0].
The blue intensity of the color; a value in the range [0.0, 1.0].
The alpha (transparency) of the color; a value in the range [0.0, 1.0].

