color.rgb
Builds a colour from red, green and blue components, with an optional opacity. Two scales meet in one call: the components run from 0 to 255 and the opacity from 0 to 1. Leave the opacity out and the colour is solid; components and opacity are both clamped to their range.
color.rgb(const int r, const int g, const int b, const float a) → const colorcolor.rgb(input int r, input int g, input int b, input float a) → input colorcolor.rgb(series int r, series int g, series int b, series float a) → series colorcolor.rgb(simple int r, simple int g, simple int b, simple float a) → simple color| Parameter | Type | Required | Description |
|---|---|---|---|
r | const int | yes | the red component, from 0 to 255 |
g | const int | yes | the green component, from 0 to 255 |
b | const int | yes | the blue component, from 0 to 255 |
a | const float | no | optional; the opacity, from 0 to 1, defaulting to solid |
Returns const color or input color or series color or simple color — A colour in the form of the arguments you pass.
indicator("Colour from components")
plot(close, title = "Close", color = color.rgb(255, 152, 0))See also colour · color.a · color.b · color.g
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.