FUIHexColor

public struct FUIHexColor : Hashable
extension FUIHexColor: Equatable
extension FUIHexColor: CustomStringConvertible

Undocumented

  • Constructs a FUIHexColor by defining a pair of hex colors to match .light and .dark background color scheme.

    Declaration

    Swift

    public init(lightColor: String? = nil, darkColor: String? = nil, elevatedLightColor: String? = nil, elevatedDarkColor: String? = nil, contrastLightColor: String? = nil, contrastDarkColor: String? = nil, elevatedContrastLightColor: String? = nil, elevatedContrastDarkColor: String? = nil)

    Parameters

    lightColor

    a hex color (RGB or RGBA) for dark background color scheme, default is 000000.

    darkColor

    a hex color (RGB or RGBA) for light background color scheme, default is FFFFFF.

    elevatedLightColor

    a hex color (RGB or RGBA) for elevated user interface in the dark background color scheme, default is 000000.

    elevatedDarkColor

    a hex color (RGB or RGBA) for elevated user interface in the light background color scheme, default is FFFFFF.

    contrastLightColor

    a hex color (RGB or RGBA) for contrast user interface in the dark background color scheme, default is 000000.

    contrastDarkColor

    a hex color (RGB or RGBA) for contrast user interface in the light background color scheme, default is FFFFFF.

    elevatedContrastLightColor

    a hex color (RGB or RGBA) for elevated and contrast user interface in the dark background color scheme, default is 000000.

    elevatedContrastDarkColor

    a hex color (RGB or RGBA) for elevated and contrast user interface in the light background color scheme, default is FFFFFF.

  • Returns a RGBA values tuple that matches with the specified hex color string.

    Declaration

    Swift

    public func rgba(_ hexString: String) -> (r: Double, g: Double, b: Double, a: Double)

    Parameters

    hexString

    specifies the hex color string.

    Return Value

    a tuple of RGBA values for corresponding FUIHexColor.

  • Returns the string value that matches with the specified color variant from FUIHexColor.

    Declaration

    Swift

    public func hex(_ variant: FUIColorVariant) -> String

    Parameters

    variant

    specifies the color variant.

    Return Value

    the string value for corresponding FUIHexColor with specific color variant.

  • Returns the FUIColorVariant that matches with the specified combination of background color scheme, user interface level and display mode settings.

    Declaration

    Swift

    public func getVariant(traits collection: UITraitCollection, background scheme: FUIBackgroundColorScheme? = .device, interface level: FUIInterfaceLevel? = .device, display mode: FUIColorDisplayMode? = .device) -> FUIColorVariant

    Parameters

    background

    specifies the background color scheme, default is .device.

    interface

    specifies the user interface level, default is .device.

    display

    specifies the display mode, default is .normal.

    Return Value

    the string value for corresponding FUIHexColor with specific color variant.