ScriptingReferenceFunctionscolorcolor.g

color.g

Reads the green component of a colour. Like the other two component functions, it returns a whole number from 0 to 255.

color.g(const color color) → const int
color.g(input color color) → input int
color.g(series color color) → series int
color.g(simple color color) → simple int
ParameterTypeRequiredDescription
colorconst coloryesthe colour to inspect

Returns const int or input int or series int or simple int — An int from 0 to 255, or na where the colour is na.

indicator("Green component of a colour")
plot(color.g(color.blue))

See also colour · color.a · color.b · 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