Builtins: colour

SignatureReturns
color.rgb(red: float, green: float, blue: float [, transparency: float]) -> colorA colour from 0 to 255 channels. transparency runs from 0, opaque, to 100, invisible, as in Pine
color.new(base: color, transparency: float) -> colorThe same colour with its transparency replaced, 0 to 100
color.from_gradient(value: float, low: float, high: float, low_color: color, high_color: color) -> colorA colour between low_color and high_color by where value sits between low and high, held at the ends
color.aqua, color.black, color.blue, color.fuchsia, color.gray, color.green, color.lime, color.maroon, color.navy, color.olive, color.orange, color.purple, color.red, color.silver, color.teal, color.white, color.yellowNamed colours, written without parentheses
  • Each builder answers a "#RRGGBB" colour when it is opaque and "#RRGGBBAA" otherwise, so its result works everywhere a colour does.
  • A nan argument answers fully transparent, "#00000000", so an absent value draws nothing rather than drawing in a wrong colour.
  • color.from_gradient blends all four channels, opacity included, so a gradient from "#22C55E00" to "#22C55E" fades in.
  • Build colours once per bar where you can. Every colour built counts toward the strings a bar may build.
let rsi: float = ta.rsi(close, 14)
let heat: color = color.from_gradient(rsi, 30, 70, color.red, color.green)
plot.candle_color(true, color.new(heat, 40), 1)
plot.dot(true, close, color.rgb(250, 204, 21, 20), 3)

Every layer of the market, Orderflow to optionflow, on one chart.

Institutional grade Orderflow data with backtesting and journaling built in. Join the waitlist for early access.

Get Access