Returns the red channel of a color as a number from 0 to 255.
color.r reads the red part of a color. Pure red gives 255 and black gives 0.
Transparency does not change the channel value. Rebuild a color from its parts with color.rgb.
Syntax
color.r(color: series color) -> series float
color.r(color: const color) -> const float
color.r(color: input color) -> input float
color.r(color: simple color) -> simple floatArguments
| Name | Type | Default | Description |
|---|---|---|---|
| color | const/ | required | The color to take the red part from. na gives na. |
Returns
const/input/simple/series float: the red value from 0 to 255; na if the color is na.
Remarks
Example
//@version=6
indicator("Red channel")
c = color.orange
plot(color.r(c), "Red", color = color.red)
plot(color.g(c), "Green", color = color.green)
plot(color.b(c), "Blue", color = color.blue)See also
Runs on Sidechair