withProminence(_:)
Returns the version of the current color that results from applying the specified prominence.
Declaration
func withProminence(_ prominence: UIColor.Prominence) -> UIColorParameters
- prominence:
The prominence to apply to the color. For options, see Prominence Swift.enum.
Return Value
The version of the color to display for the specified prominence.
Discussion
Interface elements, such as text labels, can have a different level of prominence in the UI. For example, a title label appears more prominently than a subtitle or caption. When you specify a label’s color, you can pass one of the UIColor.Prominence constants to withProminence(_:) to communicate how prominently to display that color in the UI.
The following code creates a label with a secondary, vibrant red color:
let label = UILabel()
label.preferredVibrancy = .automatic
label.textColor = .systemRed.withProminence(.secondary)