🎨Colors

Color API

File: color‑indicator.api.ts

  • Predefined colors: color.red, color.green, color.blue, color.black, color.white, etc.

  • Utility: rgba(r, g, b, a) → returns "rgba(...)".

The Color API provides a simple way to work with predefined base colors and to create custom RGBA colors for your indicators. It’s often used with the Inputs API (input.color) and other style options where colors are required.


BaseColors

Description

A collection of predefined colors (hex values). These cover common colors like black, red, blue, yellow, etc.

Syntax

BaseColors.<colorName>

Available Colors

Name
RGB Value

black

rgb(0, 0, 0)

gray

rgb(128, 128, 128)

silver

rgb(192, 192, 192)

white

rgb(255, 255, 255)

maroon

rgb(128, 0, 0)

red

rgb(255, 0, 0)

purple

rgb(128, 0, 128)

fuchsia

rgb(255, 0, 255)

green

rgb(0, 128, 0)

lime

rgb(0, 255, 0)

olive

rgb(128, 128, 0)

yellow

rgb(255, 255, 0)

navy

rgb(0, 0, 128)

blue

rgb(0, 0, 255)

teal

rgb(0, 128, 128)

aqua

rgb(0, 255, 255)

Example


RGBAColor

Description

Represents a color using red, green, blue, and alpha (transparency) components.

Syntax

Example


Tips

  • Use color when you want quick, predefined colors.

  • Use rgba() when you need transparency or custom mixes.

Warning

Good Practice

Last updated