The seventeen named colours: aqua, black, blue, fuchsia, gray, green, lime, maroon, navy, olive, orange, purple, red, silver, teal, white and yellow.
Each color.* constant is a const color, so it is accepted anywhere a color argument is: plot(color = ...), bgcolor, plotshape, label.new, line.new, box.new and the colour of an input.color default. They are fully opaque. To fade one, wrap it in color.new(color.red, 70), where 70 is the transparency in percent.
A colour is a value like any other. You can pick between two with a ternary, build one from channels with color.rgb, or blend between two with color.from_gradient. A colour that is na draws nothing, which is how a plot hides itself on bars where a condition is false.
Constants
| Name | Value | Description |
|---|---|---|
color.aqua | #00BCD4 | A cyan-blue. |
color.black | #363A45 | A soft near-black. |
color.blue | #2962FF | A saturated blue. |
color.fuchsia | #E040FB | A bright magenta-pink. |
color.gray | #787B86 | A mid gray. |
color.green | #4CAF50 | A medium green. |
color.lime | #00E676 | A vivid green. |
color.maroon | #880E4F | A dark red-purple. |
color.navy | #311B92 | A deep blue-violet. |
color.olive | #808000 | A dark yellow-green. |
color.orange | #FF9800 | A warm orange. |
color.purple | #9C27B0 | A medium purple. |
color.red | #F23645 | A strong red. |
color.silver | #B2B5BE | A light gray. |
color.teal | #089981 | A blue-green. |
color.white | #FFFFFF | Pure white. |
color.yellow | #FDD835 | A warm yellow. |
Remarks
- The hex values in the list are the opaque palette values. Transparency is not part of the constant.
- Colours given as plain strings such as "red" are not valid in Pine; use the constant or a #RRGGBB literal.
- On Sidechair:
color.bluedraws as #2196F3 instead of #2962FF; the other sixteen constants match the values listed here.
Example
//@version=6
indicator("Palette", overlay = true)
fast = ta.ema(close, 9)
slow = ta.ema(close, 21)
plot(fast, "Fast", color.orange, 2)
plot(slow, "Slow", color.navy, 2)
bgcolor(fast > slow ? color.new(color.green, 88) : color.new(color.red, 88))See also
Runs on Sidechair