withAlpha

fun withAlpha(alpha: Double, result: Color? = definedExternally): Color(source)

Creates a new Color that has the same red, green, and blue components as this Color, but with the specified alpha value.

const translucentRed = Color.RED.withAlpha(0.9);

Return

The modified result parameter or a new Color instance if one was not provided.

Parameters

alpha

The new alpha component.

result

The object onto which to store the result.

See also