SmartHexColor
@propertyWrapper
public struct SmartHexColor : Codable
Undocumented
-
Undocumented
Declaration
Swift
public var wrappedValue: UIColor?
-
Undocumented
Declaration
Swift
public init(wrappedValue: UIColor?, encodeHexFormat: HexFormat? = nil)
-
Declaration
Swift
public init(from decoder: Decoder) throws
-
Declaration
Swift
public func encode(to encoder: Encoder) throws
-
Undocumented
Declaration
Swift
public static func toColor(from hex: String, format: SmartHexColor.HexFormat) -> UIColor?
-
定义 16 进制颜色代码的格式(支持带
#
和不带#
的格式)格式说明
无透明度:
RGB
:3 位,例如F00
(等价于FF0000
)#RGB
:带#
前缀的 3 位,例如#F00
RRGGBB
:6 位,例如FF0000
#RRGGBB
:带#
前缀的 6 位,例如#FF0000
带透明度:
RGBA
:4 位,例如F008
(等价于FF000088
)#RGBA
:带#
前缀的 4 位,例如#F008
RRGGBBAA
:8 位,例如FF000080
#RRGGBBAA
:带#
前缀的 8 位,例如#FF000080
注意:枚举值名称中的
hash
表示格式包含#
前缀。Declaration
Swift
public enum HexFormat