FUIHexColor
public struct FUIHexColor : Hashable
extension FUIHexColor: Equatable
extension FUIHexColor: CustomStringConvertible
Undocumented
-
init(lightColor:darkColor:elevatedLightColor:elevatedDarkColor:contrastLightColor:contrastDarkColor:elevatedContrastLightColor:elevatedContrastDarkColor:)Constructs a
FUIHexColorby defining a pair of hex colors to match.lightand.darkbackground 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
lightColora hex color (RGB or RGBA) for
darkbackground color scheme, default is000000.darkColora hex color (RGB or RGBA) for
lightbackground color scheme, default isFFFFFF.elevatedLightColora hex color (RGB or RGBA) for
elevateduser interface in thedarkbackground color scheme, default is000000.elevatedDarkColora hex color (RGB or RGBA) for
elevateduser interface in thelightbackground color scheme, default isFFFFFF.contrastLightColora hex color (RGB or RGBA) for
contrastuser interface in thedarkbackground color scheme, default is000000.contrastDarkColora hex color (RGB or RGBA) for
contrastuser interface in thelightbackground color scheme, default isFFFFFF.elevatedContrastLightColora hex color (RGB or RGBA) for
elevatedandcontrastuser interface in thedarkbackground color scheme, default is000000.elevatedContrastDarkColora hex color (RGB or RGBA) for
elevatedandcontrastuser interface in thelightbackground color scheme, default isFFFFFF. -
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
hexStringspecifies 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) -> StringParameters
variantspecifies the color variant.
Return Value
the string value for corresponding
FUIHexColorwith specific color variant. -
Returns the
FUIColorVariantthat 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) -> FUIColorVariantParameters
backgroundspecifies the background color scheme, default is
.device.interfacespecifies the user interface level, default is
.device.displayspecifies the display mode, default is
.normal.Return Value
the string value for corresponding
FUIHexColorwith specific color variant.