Sidechair

color.t()

Browse the reference

Returns how transparent a color is, from 0 for solid to 100 for invisible.

Try it in the editor

color.t reads the transparency that color.new or color.rgb set. A color with no transparency set returns 0.

Use it to read a setting back, or to make a second color with the same see-through level.

Syntax

Pine Script
color.t(color: series color) -> series float
color.t(color: const color) -> const float
color.t(color: input color) -> input float
color.t(color: simple color) -> simple float

Arguments

NameTypeDefaultDescription
colorconst/input/simple/series colorrequiredThe color to take the transparency from, 0 to 100. na gives na.

Returns

const/input/simple/series float: the transparency from 0 to 100; na if the color is na.

Remarks

  • The value is rounded to a whole number.

Example

Pine ScriptTransparency round tripOpen in editor
//@version=6
indicator("Transparency")
c = color.new(color.blue, 70)
plot(color.t(c), "Blue at 70", color = color.blue, style = plot.style_stepline)
plot(color.t(color.red), "Red solid", color = color.red, style = plot.style_stepline)

See also

Runs on Sidechair