UIColor new 属性 for iOS 13、比如label,secondaryLabel,tertiaryLabel,quaternaryLabel,这个有什么用?

UIColor new property for iOS 13, such as label, secondaryLabel, tertiaryLabel and quaternaryLabel, what is use of this?

iOS 13 为UIColor class引入了一些新的属性,例如label、secondaryLabel、tertiaryLabel和quaternaryLabel

这些属性有什么用? , 如何使用这些属性?

/* Foreground colors for static text and related elements.
     */
    @available(iOS 13.0, *)
    open class var label: UIColor { get }

    @available(iOS 13.0, *)
    open class var secondaryLabel: UIColor { get }

    @available(iOS 13.0, *)
    open class var tertiaryLabel: UIColor { get }

    @available(iOS 13.0, *)
    open class var quaternaryLabel: UIColor { get }

这些被称为语义颜色。这意味着颜色名称的定义与其实际颜色无关。相反,它是按用途命名的。这将帮助您在深色模式和浅色模式以及许多其他情况下使用颜色,而无需担心颜色的对比度。

(系统的)某些颜色有四种不同的变化:

  • 小学

  • 中学

  • 大专

  • 四元

这些通常是原始颜色的较浅和较深版本。

一些主题还有其他变体,例如 baselifted,用于正常和模式演示以防止颜色在视觉上混合.

观看 Implementing Dark Mode on iOS 了解更多信息