core-ktx / androidx.graphics / android.graphics.Color / component4

component4

inline operator fun Color.component4(): Float

Returns the fourth component of the color. For instance, when the color model of the color is android.graphics.ColorSpace.Model.RGB, the fourth component is "alpha".

This method allows to use destructuring declarations when working with colors, for example:

val (red, green, blue, alpha) = myColor