GCKColor Class

GCKColor Class Reference

Overview

A class that represents an RGBA color.

Inherits NSObject, <NSCopying>, and <NSSecureCoding>.

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) - initWithCGColor:alpha:
 Constructs a GCKColor object from a CGColor and a given alpha value. More...
 
(instancetype) - initWithCSSString:
 Constructs a GCKColor object from a CSS string representation in the form "#RRGGBBAA" or "#RRGGBB". 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) 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

- (CGFloat) red
readnonatomicassign

The red intensity of the color; a value in the range [0.0, 1.0].

- (CGFloat) green
readnonatomicassign

The green intensity of the color; a value in the range [0.0, 1.0].

- (CGFloat) blue
readnonatomicassign

The blue intensity of the color; a value in the range [0.0, 1.0].

- (CGFloat) alpha
readnonatomicassign

The alpha (transparency) of the color; a value in the range [0.0, 1.0].

Send feedback about...