Color

public typealias Color = UIColor
  • SwifterSwift: Random color.

    Declaration

    Swift

    static var random: Color { get }
  • Undocumented

    Declaration

    Swift

    var rgbComponents: (red: Int, green: Int, blue: Int) { get }
  • Undocumented

    Declaration

    Swift

    var cgFloatComponents: (red: CGFloat, green: CGFloat, blue: CGFloat) { get }
  • Undocumented

    Declaration

    Swift

    var hsbaComponents: (hue: CGFloat, saturation: CGFloat, brightness: CGFloat, alpha: CGFloat) { get }
  • SwifterSwift: Hexadecimal value string (read-only).

    Declaration

    Swift

    var hexString: String { get }
  • SwifterSwift: Short hexadecimal value string (read-only, if applicable).

    Declaration

    Swift

    var shortHexString: String? { get }
  • SwifterSwift: Short hexadecimal value string, or full hexadecimal string if not possible (read-only).

    Declaration

    Swift

    var shortHexOrHexString: String { get }
  • SwifterSwift: Alpha of Color (read-only).

    Declaration

    Swift

    var alpha: CGFloat { get }
  • SwifterSwift: CoreImage.CIColor (read-only)

    Declaration

    Swift

    var coreImageColor: CoreImage.CIColor? { get }
  • SwifterSwift: Get UInt representation of a Color (read-only).

    Declaration

    Swift

    var uInt: UInt { get }
  • SwifterSwift: Get color complementary (read-only, if applicable).

    Declaration

    Swift

    var complementary: Color? { get }
  • SwifterSwift: Blend two Colors

    Declaration

    Swift

    static func blend(_ color1: Color, intensity1: CGFloat = 0.5, with color2: Color, intensity2: CGFloat = 0.5) -> Color

    Parameters

    color1

    first color to blend

    intensity1

    intensity of first color (default is 0.5)

    color2

    second color to blend

    intensity2

    intensity of second color (default is 0.5)

    Return Value

    Color created by blending first and seond colors.

  • SwifterSwift: Lighten a color

    let color = Color(red: r, green: g, blue: b, alpha: a)
    let lighterColor: Color = color.lighten(by: 0.2)
    

    Declaration

    Swift

    func lighten(by percentage: CGFloat = 0.2) -> Color

    Parameters

    percentage

    Percentage by which to lighten the color

    Return Value

    A lightened color

  • SwifterSwift: Darken a color

    let color = Color(red: r, green: g, blue: b, alpha: a)
    let darkerColor: Color = color.darken(by: 0.2)
    

    Declaration

    Swift

    func darken(by percentage: CGFloat = 0.2) -> Color

    Parameters

    percentage

    Percentage by which to darken the color

    Return Value

    A darkened color

  • SwifterSwift: Create Color from RGB values with optional transparency.

    Declaration

    Swift

    convenience init?(red: Int, green: Int, blue: Int, transparency: CGFloat = 1)

    Parameters

    red

    red component.

    green

    green component.

    blue

    blue component.

    transparency

    optional transparency value (default is 1).

  • SwifterSwift: Create Color from hexadecimal value with optional transparency.

    Declaration

    Swift

    convenience init?(hex: Int, transparency: CGFloat = 1)

    Parameters

    hex

    hex Int (example: 0xDECEB5).

    transparency

    optional transparency value (default is 1).

  • SwifterSwift: Create Color from hexadecimal string with optional transparency (if applicable).

    Declaration

    Swift

    convenience init?(hexString: String, transparency: CGFloat = 1)

    Parameters

    hexString

    hexadecimal string (examples: EDE7F6, 0xEDE7F6, #EDE7F6, #0ff, 0xF0F, ..).

    transparency

    optional transparency value (default is 1).

  • SwifterSwift: Create Color from a complementary of a Color (if applicable).

    Declaration

    Swift

    convenience init?(complementaryFor color: Color)

    Parameters

    color

    color of which opposite color is desired.

  • SwifterSwift: Brand identity color of popular social media platform.

    See more

    Declaration

    Swift

    struct Social
  • CSS

    SwifterSwift: CSS colors.

    See more

    Declaration

    Swift

    struct CSS
  • SwifterSwift: Flat UI colors

    See more

    Declaration

    Swift

    struct FlatUI