An immutable color.
More...
#import <CPTColor.h>
An immutable color.
An immutable object wrapper class around CGColorRef. It provides convenience methods to create the same predefined colors defined by UIColor.
◆ blackColor
+ (nonnull instancetype) blackColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque black color.
- Returns
- A shared CPTColor object initialized with a fully opaque black color.
◆ blueColor
+ (nonnull instancetype) blueColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque blue color.
- Returns
- A shared CPTColor object initialized with a fully opaque blue color.
◆ brownColor
+ (nonnull instancetype) brownColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque brown color.
- Returns
- A shared CPTColor object initialized with a fully opaque brown color.
◆ clearColor
+ (nonnull instancetype) clearColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully transparent color.
- Returns
- A shared CPTColor object initialized with a fully transparent color.
◆ colorWithAlphaComponent:
- (nonnull instancetype) colorWithAlphaComponent: |
|
(CGFloat) |
alpha |
|
Creates and returns a new CPTColor instance having color components identical to the current object but having the provided alpha component.
- Parameters
-
alpha | The alpha component (0 ≤ alpha ≤ 1 ). |
- Returns
- A new CPTColor instance having the provided alpha component.
◆ colorWithCGColor:
+ (nonnull instancetype) colorWithCGColor: |
|
(nonnull CGColorRef) |
newCGColor |
|
Creates and returns a new CPTColor instance initialized with the provided CGColorRef.
- Parameters
-
newCGColor | The color to wrap. |
- Returns
- A new CPTColor instance initialized with the provided CGColorRef.
◆ colorWithComponentRed:green:blue:alpha:
Creates and returns a new CPTColor instance initialized with the provided RGBA color components.
- Parameters
-
red | The red component (0 ≤ red ≤ 1 ). |
green | The green component (0 ≤ green ≤ 1 ). |
blue | The blue component (0 ≤ blue ≤ 1 ). |
alpha | The alpha component (0 ≤ alpha ≤ 1 ). |
- Returns
- A new CPTColor instance initialized with the provided RGBA color components.
◆ colorWithGenericGray:
+ (nonnull instancetype) colorWithGenericGray: |
|
(CGFloat) |
gray |
|
Creates and returns a new CPTColor instance initialized with the provided gray level.
- Parameters
-
gray | The gray level (0 ≤ gray ≤ 1 ). |
- Returns
- A new CPTColor instance initialized with the provided gray level.
◆ colorWithNativeColor:
+ (nonnull instancetype) colorWithNativeColor: |
|
(nonnull CPTNativeColor *) |
newColor |
|
Creates and returns a new CPTColor instance initialized with the provided platform-native color.
The color can be a dynamic system color or catalog color. This adds support for Dark Mode in iOS13.
- Parameters
-
newColor | The color to wrap. |
- Returns
- A new CPTColor instance initialized with the provided platform-native color.
◆ colorWithUIColor:
+ (nonnull instancetype) colorWithUIColor: |
|
(nonnull UIColor *) |
newUIColor |
|
Creates and returns a new CPTColor instance initialized with the provided UIColor.
The UIColor can be a dynamic system color or catalog color. This adds support for Dark Mode in iOS 13.
- Parameters
-
newUIColor | The color to wrap. |
- Returns
- A new CPTColor instance initialized with the provided UIColor.
◆ cyanColor
+ (nonnull instancetype) cyanColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque cyan color.
- Returns
- A shared CPTColor object initialized with a fully opaque cyan color.
◆ darkGrayColor
+ (nonnull instancetype) darkGrayColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque 33% gray color.
- Returns
- A shared CPTColor object initialized with a fully opaque 33% gray color.
◆ grayColor
+ (nonnull instancetype) grayColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque 50% gray color.
- Returns
- A shared CPTColor object initialized with a fully opaque 50% gray color.
◆ greenColor
+ (nonnull instancetype) greenColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque green color.
- Returns
- A shared CPTColor object initialized with a fully opaque green color.
◆ initWithCGColor:
- (nonnull instancetype) initWithCGColor: |
|
(nonnull CGColorRef) |
newCGColor |
|
Initializes a newly allocated CPTColor object with the provided CGColorRef.
- Parameters
-
newCGColor | The color to wrap. |
- Returns
- The initialized CPTColor object.
◆ initWithCoder:
- (nullable instancetype) initWithCoder: |
|
(nonnull NSCoder *) |
coder |
|
Returns an object initialized from data in a given unarchiver.
- Parameters
-
coder | An unarchiver object. |
- Returns
- An object initialized from data in a given unarchiver.
◆ initWithComponentRed:green:blue:alpha:
Initializes a newly allocated CPTColor object with the provided RGBA color components.
- Parameters
-
red | The red component (0 ≤ red ≤ 1 ). |
green | The green component (0 ≤ green ≤ 1 ). |
blue | The blue component (0 ≤ blue ≤ 1 ). |
alpha | The alpha component (0 ≤ alpha ≤ 1 ). |
- Returns
- The initialized CPTColor object.
◆ initWithNativeColor:
- (nonnull instancetype) initWithNativeColor: |
|
(nonnull CPTNativeColor *) |
newColor |
|
Initializes a newly allocated CPTColor object with the provided platform-native color.
The color can be a dynamic system color or catalog color. This adds support for Dark Mode in macOS 10.14 and iOS 13.
- Parameters
-
newColor | The color to wrap. |
- Returns
- The initialized CPTColor object.
◆ initWithUIColor:
- (nonnull instancetype) initWithUIColor: |
|
(nonnull UIColor *) |
newUIColor |
|
Initializes a newly allocated CPTColor object with the provided UIColor.
The UIColor can be a dynamic system color or catalog color. This adds support for Dark Mode in iOS 13.
- Parameters
-
newUIColor | The color to wrap. |
- Returns
- The initialized CPTColor object.
◆ isEqual:
- (BOOL) isEqual: |
|
(nullable id) |
object |
|
|
implementation |
Returns a boolean value that indicates whether the received is equal to the given object. Colors are equal if they have equal cgColor properties.
- Parameters
-
object | The object to be compared with the receiver. |
- Returns
- YES if
object
is equal to the receiver, NO otherwise.
◆ lightGrayColor
+ (nonnull instancetype) lightGrayColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque 67% gray color.
- Returns
- A shared CPTColor object initialized with a fully opaque 67% gray color.
◆ magentaColor
+ (nonnull instancetype) magentaColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque magenta color.
- Returns
- A shared CPTColor object initialized with a fully opaque magenta color.
◆ orangeColor
+ (nonnull instancetype) orangeColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque orange color.
- Returns
- A shared CPTColor object initialized with a fully opaque orange color.
◆ purpleColor
+ (nonnull instancetype) purpleColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque purple color.
- Returns
- A shared CPTColor object initialized with a fully opaque purple color.
◆ redColor
+ (nonnull instancetype) redColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque red color.
- Returns
- A shared CPTColor object initialized with a fully opaque red color.
◆ whiteColor
+ (nonnull instancetype) whiteColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque white color.
- Returns
- A shared CPTColor object initialized with a fully opaque white color.
◆ yellowColor
+ (nonnull instancetype) yellowColor |
|
|
|
Returns a shared instance of CPTColor initialized with a fully opaque yellow color.
- Returns
- A shared CPTColor object initialized with a fully opaque yellow color.
◆ cgColor
◆ nativeColor
The platform-native color to wrap around.
◆ opaque
If YES, the color is completely opaque.
◆ uiColor
The documentation for this class was generated from the following files: