iOS & macOS Charting Documentation - SciChart iOS & macOS Charts SDK v4.x

UIColor(Util)

@interface UIColor (Util)

Helper category with some color constants and helper methods to work with Color.

  • Get hex color code from Color. Color code bytes order is 0xAABBGGRR.

    Declaration

    Objective-C

    - (unsigned int)colorABGRCode;

    Swift

    func colorABGRCode() -> UInt32
  • Get hex color code from Color. Color code bytes order is 0xAARRGGBB.

    Declaration

    Objective-C

    - (unsigned int)colorARGBCode;

    Swift

    func colorARGBCode() -> UInt32
  • Create Color from hex color code. Color code bytes order is 0xAABBGGRR.

    Declaration

    Objective-C

    + (nonnull UIColor *)fromABGRColorCode:(unsigned int)color;

    Swift

    class func fromABGRColorCode(_ color: UInt32) -> UIColor
  • Create Color from hex color code. Color code bytes order is 0xAARRGGBB.

    Declaration

    Objective-C

    + (nonnull UIColor *)fromARGBColorCode:(unsigned int)color;

    Swift

    class func fromARGBColorCode(_ color: UInt32) -> UIColor
  • Create a new Color from red, green, blue and alpha channels.

    Declaration

    Objective-C

    + (nonnull UIColor *)sci_colorWithRed:(const unsigned int)red
                                    green:(const unsigned int)green
                                     blue:(const unsigned int)blue
                                    alpha:(const unsigned int)alpha;

    Swift

    class func colorWith(red: UInt32, green: UInt32, blue: UInt32, alpha: UInt32) -> UIColor
  • Deprecated

    SCIColor.colorWithR:G:B:A is deprecated. Please use SCIColor.sci_colorWithRed:green:blue:alpha instead

    Create a new Color from red, green, blue and alpha channels.

    Declaration

    Objective-C

    + (nonnull UIColor *)colorWithR:(const unsigned int)red
                                  G:(const unsigned int)green
                                  B:(const unsigned int)blue
                                  A:(const unsigned int)alpha;

    Swift

    /*not inherited*/ init(r red: UInt32, g green: UInt32, b blue: UInt32, a alpha: UInt32)
  • Create a new Color in raw unsigned int representation from red, green, blue and alpha channels.

    Declaration

    Objective-C

    + (const unsigned int)sci_colorCodeWithRed:(const unsigned int)red
                                         green:(const unsigned int)green
                                          blue:(const unsigned int)blue
                                         alpha:(const unsigned int)alpha;

    Swift

    class func colorCodeWithRed(red: UInt32, green: UInt32, blue: UInt32, alpha: UInt32) -> UInt32
  • Deprecated

    SCIColor.colorCodeWithR:G:B:A is deprecated. Please use SCIColor.sci_colorCodeWithRed:green:blue:alpha instead

    Create a new Color in raw unsigned int representation from red, green, blue and alpha channels.

    Declaration

    Objective-C

    + (const unsigned int)colorCodeWithR:(const unsigned int)red
                                       G:(const unsigned int)green
                                       B:(const unsigned int)blue
                                       A:(const unsigned int)alpha;

    Swift

    class func colorCode(withR red: UInt32, g green: UInt32, b blue: UInt32, a alpha: UInt32) -> UInt32
  • Applies specified opacity value to provided color.

    Declaration

    Objective-C

    + (unsigned int)argb:(unsigned int)color withOpacity:(float)opacity;

    Swift

    class func argb(_ color: UInt32, withOpacity opacity: Float) -> UInt32

    Parameters

    color

    The input color.

    opacity

    The opacity value.

    Return Value

    The output color.

  • Swap bytes from ARGB into ABGR.

    Declaration

    Objective-C

    + (unsigned int)swapBytesFromARGBIntoABGR:(unsigned int)argb;

    Swift

    class func swapBytesFromARGB(intoABGR argb: UInt32) -> UInt32
  • Gets alpha value from color.

    Declaration

    Objective-C

    + (unsigned char)alpha:(unsigned int)color;

    Swift

    class func alpha(_ color: UInt32) -> UInt8

    Parameters

    color

    The color value.

    Return Value

    The alpha value.

  • Gets red value from color.

    Declaration

    Objective-C

    + (unsigned char)red:(unsigned int)color;

    Swift

    class func red(_ color: UInt32) -> UInt8

    Parameters

    color

    The color value.

    Return Value

    The red value.

  • Gets green value from color.

    Declaration

    Objective-C

    + (unsigned char)green:(unsigned int)color;

    Swift

    class func green(_ color: UInt32) -> UInt8

    Parameters

    color

    The color value.

    Return Value

    The green value.

  • Gets blue value from color.

    Declaration

    Objective-C

    + (unsigned char)blue:(unsigned int)color;

    Swift

    class func blue(_ color: UInt32) -> UInt8

    Parameters

    color

    The color value.

    Return Value

    The blue value.

  • Gets the inverted color for provided color.

    Declaration

    Objective-C

    + (unsigned int)getInvertedColor:(unsigned int)color;

    Swift

    class func getInvertedColor(_ color: UInt32) -> UInt32

    Parameters

    color

    The input color.

    Return Value

    The inverted color.

  • Check is the passed in color is transparent.

    Declaration

    Objective-C

    + (BOOL)isTransparent:(unsigned int)color;

    Swift

    class func isTransparent(_ color: UInt32) -> Bool

    Parameters

    color

    The color value.

    Return Value

    YES if the color is transparent, otherwise - NO.