color
Types a colour value (color(na)).
#Functions
#colorfunction
Types a colour value (color(na)).
color(x: color): color| Parameter | Type | Description |
|---|---|---|
x | color | The value. |
Returns color.
Example
const c = color(na)Since ChartScript 1
#color.bfunction
The blue component (0-255).
color.b(color: color): float| Parameter | Type | Description |
|---|---|---|
color | color | The colour. |
Returns float.
Example
const v = color.b(color.orange)Since ChartScript 1
#color.from_gradientfunction
A colour between bottom_color and top_color by where value sits.
color.from_gradient(value: float, bottom_value: float, top_value: float, bottom_color: color, top_color: color): color| Parameter | Type | Description |
|---|---|---|
value | float | The value. |
bottom_value | float | The value of the bottom colour. |
top_value | float | The value of the top colour. |
bottom_color | color | The colour at bottom_value. |
top_color | color | The colour at top_value. |
Returns color.
Example
const c = color.from_gradient(ta.rsi(close, 14), 30, 70, color.down, color.up)Since ChartScript 1
#color.gfunction
The green component (0-255).
color.g(color: color): float| Parameter | Type | Description |
|---|---|---|
color | color | The colour. |
Returns float.
Example
const v = color.g(color.orange)Since ChartScript 1
#color.newfunction
The colour with a new transparency (theme colours stay theme colours).
color.new(color: color, transp: float): color| Parameter | Type | Description |
|---|---|---|
color | color | The colour. |
transp | float | Transparency from 0 (opaque) to 100 (invisible). |
Returns color.
Example
const c = color.new(color.up, 50)Since ChartScript 1
#color.rfunction
The red component (0-255).
color.r(color: color): float| Parameter | Type | Description |
|---|---|---|
color | color | The colour. |
Returns float.
Example
const v = color.r(color.orange)Since ChartScript 1
#color.rgbfunction
A colour from red, green and blue.
color.rgb(red: float, green: float, blue: float, { transp?: float = 0 }): color| Parameter | Type | Description |
|---|---|---|
red | float | Red (0-255). |
green | float | Green (0-255). |
blue | float | Blue (0-255). |
transp | floatdefault 0 | Transparency from 0 (opaque) to 100 (invisible). |
Returns color.
Example
const c = color.rgb(255, 128, 0)Since ChartScript 1
#color.tfunction
The transparency (0-100).
color.t(color: color): float| Parameter | Type | Description |
|---|---|---|
color | color | The colour. |
Returns float.
Example
const v = color.t(color.new(color.red, 40))Since ChartScript 1
#color.themefunction
One colour per chart theme: dark, light and high-contrast (light / hc fall back to dark). The script re-runs when the theme changes.
color.theme(dark: color, { light?: color = na, hc?: color = na }): color| Parameter | Type | Description |
|---|---|---|
dark | color | The colour on a dark chart. |
light | colordefault na | On a light chart. |
hc | colordefault na | On a high-contrast chart. |
Returns simple color.
Example
const c = color.theme({ dark: #26A69A, light: #00897B, hc: #00FFB0 })Since ChartScript 1
#Constants
| Name | Type | Description |
|---|---|---|
color.accent | color | Theme colour "accent": follows the chart look (dark, light, high contrast, colour-blind). |
color.amber | color | Theme colour "amber": the chart's amber (gold) series colour, the one the built-in studies draw with; follows the chart look (dark, light, high contrast, colour-blind). |
color.aqua | color | Named colour aqua (#00BCD4). |
color.black | color | Named colour black (#363A45). |
color.blue | color | Named colour blue (#2196F3). |
color.cyan | color | Theme colour "cyan": the chart's cyan series colour, the one the built-in studies draw with; follows the chart look (dark, light, high contrast, colour-blind). |
color.down | color | Theme colour "down": follows the chart look (dark, light, high contrast, colour-blind). |
color.fuchsia | color | Named colour fuchsia (#E040FB). |
color.gray | color | Named colour gray (#787B86). |
color.green | color | Named colour green (#4CAF50). |
color.grid | color | Theme colour "grid": follows the chart look (dark, light, high contrast, colour-blind). |
color.lime | color | Named colour lime (#00E676). |
color.magenta | color | Theme colour "magenta": the chart's magenta (pink) series colour, the one the built-in studies draw with; follows the chart look (dark, light, high contrast, colour-blind). |
color.maroon | color | Named colour maroon (#880E4F). |
color.muted | color | Theme colour "muted": follows the chart look (dark, light, high contrast, colour-blind). |
color.navy | color | Named colour navy (#311B92). |
color.olive | color | Named colour olive (#808000). |
color.orange | color | Named colour orange (#FF9800). |
color.purple | color | Named colour purple (#9C27B0). |
color.red | color | Named colour red (#F23645). |
color.silver | color | Named colour silver (#B2B5BE). |
color.teal | color | Named colour teal (#089981). |
color.text | color | Theme colour "text": follows the chart look (dark, light, high contrast, colour-blind). |
color.up | color | Theme colour "up": follows the chart look (dark, light, high contrast, colour-blind). |
color.violet | color | Theme colour "violet": the chart's violet (lilac) series colour, the one the built-in studies draw with; follows the chart look (dark, light, high contrast, colour-blind). |
color.white | color | Named colour white (#FFFFFF). |
color.yellow | color | Named colour yellow (#FDD835). |