AI-generated Key Takeaways
-
GCKColor is a class that represents an RGBA color and inherits from NSObject, <NSCopying>, and <NSCoding>.
-
You can initialize a GCKColor object using red, green, blue, and alpha values, or from a UIColor or CGColor.
-
A GCKColor object can also be created from and converted to a CSS string representation in the format "#RRGGBBAA".
-
The class provides convenient methods to get standard colors like black, red, green, blue, cyan, magenta, yellow, and white.
-
The red, green, blue, and alpha properties of a GCKColor object represent the intensity and transparency of the color, with values ranging from 0.0 to 1.0.
Overview
A class that represents an RGBA color.
Inherits NSObject, <NSCopying>, and <NSCoding>.
Instance Method Summary | |
| (instancetype) | - initWithRed:green:blue:alpha: |
| Designated initializer. More... | |
| (instancetype) | - initWithRed:green:blue: |
| Constructs a GCKColor object with the given red, green, blue values and an alpha value of 1.0 (full opacity). More... | |
| (instancetype) | - initWithUIColor: |
| Constructs a GCKColor object from a UIColor. More... | |
| (instancetype) | - initWithCGColor: |
| Constructs a GCKColor object from a CGColor. More... | |
| (instancetype) | - initWithCSSString: |
| Constructs a GCKColor object from a CSS string representation in the form "#RRGGBBAA". More... | |
| (NSString *) | - CSSString |
| Returns a CSS string representation of the color, in the form "#RRGGBBAA". More... | |
Class Method Summary | |
| (GCKColor *) | + black |
| The color black. More... | |
| (GCKColor *) | + red |
| The color red. More... | |
| (GCKColor *) | + green |
| The color green. More... | |
| (GCKColor *) | + blue |
| The color blue. More... | |
| (GCKColor *) | + cyan |
| The color cyan. More... | |
| (GCKColor *) | + magenta |
| The color magenta. More... | |
| (GCKColor *) | + yellow |
| The color yellow. More... | |
| (GCKColor *) | + white |
| The color white. More... | |
Property Summary | |
| CGFloat | red |
| The red intensity of the color; a value in the range [0.0, 1.0]. More... | |
| CGFloat | green |
| The green intensity of the color; a value in the range [0.0, 1.0]. More... | |
| CGFloat | blue |
| The blue intensity of the color; a value in the range [0.0, 1.0]. More... | |
| CGFloat | alpha |
| The alpha (transparency) of the color; a value in the range [0.0, 1.0]. More... | |
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) initWithCSSString: | (NSString *) | CSSString |
Constructs a GCKColor object from a CSS string representation in the form "#RRGGBBAA".
| - (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
|
readnonatomicassign |
The red intensity of the color; a value in the range [0.0, 1.0].
|
readnonatomicassign |
The green intensity of the color; a value in the range [0.0, 1.0].
|
readnonatomicassign |
The blue intensity of the color; a value in the range [0.0, 1.0].
|
readnonatomicassign |
The alpha (transparency) of the color; a value in the range [0.0, 1.0].