SmartHexColor

@propertyWrapper
public struct SmartHexColor : Codable

Undocumented

PropertyWrapper

  • 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 表示格式包含 # 前缀。

    See more

    Declaration

    Swift

    public enum HexFormat