Returns the green channel of a color as a number from 0 to 255.
color.g reads the green part of a color. Pure green gives 255 and black gives 0.
A fully transparent color keeps its green value, since transparency is stored apart from the channels.
Syntax
color.g(color: series color) -> series float
color.g(color: const color) -> const float
color.g(color: input color) -> input float
color.g(color: simple color) -> simple floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| color | const/ | required | The color to take the green part from. na gives na. |
Returns
const/input/simple/series float: the green value from 0 to 255; na if the color is na.
Remarks
Example
//@version=6
indicator("Green channel")
c = color.from_gradient(ta.rsi(close, 14), 30, 70, color.red, color.green)
plot(color.g(c), "Green", color = color.green)See also
Runs on Sidechair