Create Color Inputs in Pine

Sep 17, 2020

A new input.color type for input() allows coders to provide script users with color selection through the script’s Settings/Inputs tab with the same color widget used throughout the TradingView user interface.

See in the example below how input.color is used to provide script users with a choice of label colors:

study("Input color example", overlay=true)
color c_up = input(, "Color Up", type = input.color)
color c_down = input(, "Color Down", type = input.color)
l =, na)
if close >= open
    label.set_text(l, "green")
    label.set_color(l, c_up)
    label.set_yloc(l, yloc.belowbar)
    label.set_style(l, label.style_labelup)
    label.set_text(l, "red")
    label.set_color(l, c_down)
    label.set_yloc(l, yloc.abovebar)
    label.set_style(l, label.style_labeldown)

The default value for the color input can be any color from the standard palette, or one you create yourself: using, 50) or #F0000080 for example. Your script users will also be able to select any combination of color/transparency through the color widget.

We hope this new feature you requested is useful. Please continue sending us your suggestions for improvement. We build TradingView for you and love receiving your feedback.

Look first Then leap

TradingView is built for you, so make sure you're getting the most of our awesome features
Launch Chart