color

Adds a color picker input to your indicator’s Inputs panel. Users can choose a base color (from predefined constants) or a custom RGBA color. Ideal for customizing the look of plots, bands, and overlays.

Syntax

input.color(title, value, id?, group?, tooltip?, inline?)

Parameters

  • title string — Label shown in the Inputs panel.

  • value BaseColors | RGBAColor — Default color. Can be either:

    • BaseColors (predefined named colors like color.red, color.blue).

    • RGBAColor object { r, g, b, a } (where a is transparency 0–1).

  • id string (optional) — Unique key for referencing this input. If omitted, auto-generated from title (lowercased, spaces removed).

  • group string (optional) — Groups this input under a collapsible section.

  • tooltip string (optional) — Small helper text shown on hover.

  • inline string (optional) — Aligns multiple inputs in the same row if they share the same key.

Return Value

{ id: string } — The assigned id, either provided or auto-generated.

Example

Result

Tips

  • Use BaseColors when you want simple predefined colors; use rgba() when you need transparency.

  • Tooltips are especially useful here—help users understand what element they are coloring (line, background, band).

Warning

Good Practice

Last updated