Lipi Reference
Lipi

Functions

color()

Converts a value to a colour. It accepts a colour only. The `color` namespace holds the functions that build a colour from components or read one apart.

Syntax · 1 of 4

                color(const color value) → const color
              

Arguments

value required const color The value to convert to the specified type, usually na.

Return Type

const color

Syntax · 2 of 4

                color(input color value) → input color
              

Arguments

value required input color The value to convert to the specified type, usually na.

Return Type

input color

Syntax · 3 of 4

                color(simple color value) → simple color
              

Arguments

value required simple color The value to convert to the specified type, usually na.

Return Type

simple color

Syntax · 4 of 4

                color(series color value) → series color
              

Arguments

value required series color The value to convert to the specified type, usually na.

Return Type

series color

Example


          //@lipi=2
indicator("color() Example", overlay=true)
// A typed na colour, set only on up bars
color c = color(na)
if close > open {
    c := color.green
}
barcolor(c)