ScriptingReferenceFunctionscolorcolor.a

color.a

Reads the opacity of a colour. Reading is asymmetric with writing: this one returns a fraction from 0 to 1, while the three component functions return whole numbers from 0 to 255.

color.a(const color color) → const float
color.a(input color color) → input float
color.a(series color color) → series float
color.a(simple color color) → simple float
ParameterTypeRequiredDescription
colorconst coloryesthe colour to inspect

Returns const float or input float or series float or simple float — A float from 0 to 1, or na where the colour is na.

indicator("Opacity of a colour")
plot(color.a(color.blue))

See also colour · color.b · color.g · color.new

Part of the function index.

Ready to put this into practice?
Try GoCharting Premium
Unlock advanced orderflow, market profile, options desk, and real-time data — everything you just read about, live in your charts.
Upgrade