Skip to main content

Color():alpha()

Get the alpha (transparency) channel of a color.

Signature​

alpha(): number

Returns

number - Alpha from 0 (transparent) to 255 (opaque).

Description​

A color written as #RRGGBB has alpha 255. A color written as #AARRGGBB uses its own alpha, and colors read from the screen keep the alpha the screen capture reports. The other channel methods (red(), green(), blue()) ignore alpha.

Example​

local color = Color("#80FF0000")
toast("Alpha: " .. color:alpha()) -- 128

Compatible Version: 1.0.0.37 and up