Sidechair

table.set_bgcolor()

Browse the reference

Sets the fill behind the whole table, which shows wherever a cell has no fill of its own.

Try it in the editor

The table background sits behind every cell that has no bgcolor of its own. Use color.new(c, transparency) for a see-through panel that lets the candles show.

A cell fill from table.cell() or table.cell_set_bgcolor() wins over this color, and na removes the table fill so the chart shows through again.

Syntax

Pine Script
table.set_bgcolor(table_id: series table, bgcolor: series color (optional)) -> void
table.set_bgcolor(bgcolor: series color (optional)) -> void

Arguments

NameTypeDefaultDescription
table_idseries tablerequiredThe table whose background fill changes.
bgcolorseries colornaFill behind the whole table. na removes it; cells with their own bgcolor keep theirs.

Returns

Nothing.

Example

Pine ScriptTint the panel by directionOpen in editor
//@version=6
indicator("table.set_bgcolor: tint", overlay = true)
var t = table.new(position.top_right, 1, 1)
if barstate.islast
    table.cell(t, 0, 0, str.tostring(close))
    table.set_bgcolor(t, close > open ? color.new(color.green, 70) : color.new(color.red, 70))

See also

Runs on Sidechair