Function

luminance

Returns the relative luminance of this color.

luminance

Source set: Common
public fun Color.luminance(): Float

Returns the relative luminance of this color.

Based on the formula for relative luminance defined in WCAG 2.0, W3C Recommendation 11 December 2008.

Return

A value between 0 (darkest black) and 1 (lightest white)

Throws: IllegalArgumentException

If the this color's color space does not use the RGB color model

Jetpack Compose beyond MaterialFree components, screens and templates for apps that don’t look like Google’s. Copy them into your app, or let your coding agent add them.Browse for free

Content updated: