headroom(_:)
Creates a new color with specified HDR content headroom.
Declaration
func headroom(_ headroom: Double?) -> ColorParameters
- headroom:
The headroom value to associate with the new color.
Return Value
A new color with the specified content headroom.
Discussion
High Dynamic Range colors (those with RGB components outside the standard [0, 1] range) should be annotated with their headroom to ensure that they are displayed correctly. Knowing content headroom allows the rendering system to automatically increase display headroom when the color is displayed and to tone map the color when the available display headroom is insufficient to render the color as intended.
For example a custom yellow color whose brightness has been increased by two exposure levels:
Color(.sRGB, red: 1.83, green: 1.47, blue: 0)
.headroom(4)note that headroom is a linear quantity, and as such any color adjustments should typically be made in a linear color space.