Sidechair

input.color()

Browse the reference

Adds a color setting to the script and returns the chosen color, including its transparency.

Try it in the editor

input.color shows a color picker in the settings and returns the color chosen, starting at defval. The returned value works anywhere a color is expected, such as plot, bgcolor and label.new.

Transparency is part of the choice, so a value picked at 80 percent transparent stays that way when used.

Syntax

Pine Script
input.color(defval: const color, title: const string (optional), tooltip: const string (optional), inline: const string (optional), group: const string (optional), confirm: const bool (optional), display: const plot_display (optional), active: input bool (optional)) -> input color

Arguments

NameTypeDefaultDescription
defvalconst colorrequiredDefault color, such as color.blue or color.new(color.red, 70).
titleconst stringnaName shown in the Settings dialog, the legend and the Data Window.
tooltipconst stringnaText shown in a tooltip beside the input in the Settings dialog.
inlineconst stringnaEntries sharing the same inline text sit on one row of the Settings dialog.
groupconst stringnaHeading the input is listed under in the Settings dialog.
confirmconst boolfalseWhen true, the script asks for this value when it is first added to the chart.
displayconst plot_displaydisplay.allWhere the value appears: a display.* constant or a combination of them.
activeinput booltrueWhen false, the input is greyed out and cannot be edited.

Returns

input color: the chosen color.

Remarks

  • Place the up and down colors on one row of the settings by giving both the same inline text.
  • On Sidechair: confirm, display and active are accepted and ignored.

Example

Pine ScriptUser-selected colorsOpen in editor
//@version=6
indicator("Colored columns")
upColor = input.color(color.teal, "Up color", inline = "c")
downColor = input.color(color.maroon, "Down color", inline = "c")
plot(close - open, "Body", color = close >= open ? upColor : downColor, style = plot.style_columns)

See also

Runs on Sidechair