Sidechair

table.set_border_color()

Browse the reference

Sets the color of the inner grid lines that separate the cells of a table.

Try it in the editor

The border is the grid inside the table; the outer edge is the frame, set with table.set_frame_color(). Changing the color does not switch the grid on: the lines stay hidden while the border width is 0.

Because the call can run on any bar, the grid can carry a signal, for example turning green above a moving average and red below it.

Syntax

Pine Script
table.set_border_color(table_id: series table, border_color: series color (optional)) -> void
table.set_border_color(border_color: series color (optional)) -> void

Arguments

NameTypeDefaultDescription
table_idseries tablerequiredThe table whose inner grid lines are recolored.
border_colorseries colornaColor of the lines between cells. na is transparent, so the grid disappears even when its width is above 0.

Returns

Nothing.

Example

Pine ScriptGrid lines that follow the trendOpen in editor
//@version=6
indicator("table.set_border_color: trend grid", overlay = true)
trendUp = close > ta.sma(close, 20)
var t = table.new(position.bottom_right, 2, 2, border_width = 1)
if barstate.islast
    table.cell(t, 0, 0, "A")
    table.cell(t, 1, 1, "B")
    table.set_border_color(t, trendUp ? color.green : color.red)

See also

Runs on Sidechair