Skip to content
ChartDeck ChartScript docs Account Open the terminal

gradient

Colour gradients (input.gradient, gradient.at).

#Functions

#gradient.atfunction

The colour of a gradient at value, lo..hi mapped onto it (outside: the end colours; na: na).

gradient.at(gradient: string, value: float, lo: float, hi: float): color
ParameterTypeDescription
gradientstringA gradient (gradient.new or input.gradient).
valuefloatThe value.
lofloatThe value at 0 %.
hifloatThe value at 100 %.

Returns color.

Example

ChartScriptFragmentOpen in editor
const g = input.gradient(gradient.new(color.blue, color.red), "Heat")
const c = gradient.at(g, ta.rsi(close, 14), 30, 70)

Since ChartScript 1

#gradient.newfunction

A colour gradient: 2 to 8 colours spread evenly from 0 to 100 %.

gradient.new(stops: const color, …): string
ParameterTypeDescription
stopsconst colorThe colours, low to high.

Returns string.

Example

ChartScriptFragmentOpen in editor
const g = input.gradient(gradient.new(color.blue, color.yellow, color.red), "Heat")

Since ChartScript 1

The ChartScript documentation is in English for now; translations will follow.