Skip to content

Function: setAlpha()

ts
function setAlpha(color, alpha): Color;

Defined in: setAlpha.ts:15

Set the alpha value for a color to a specific value.

Parameters

ParameterTypeDescription
colorColorthe color to set the value for
alphastring | numbera number or string representing alpha. Numbers >= 1 are treated as a percentage (0–100). Numbers < 1 are treated as a ratio (0–1). Percentage strings are also accepted (e.g. "50%").

Returns

Color

a new color with the new alpha value