Sidechair

table.cell_set_text_color()

Browse the reference

Recolors the text of one cell without changing its fill, size or wording.

Try it in the editor

Pick a color that reads against the cell's own bgcolor, or against the table's background when the cell has none. color.new() adds transparency for a quieter look.

Driving the color from the sign of a value gives the familiar green-for-up, red-for-down readout.

Syntax

Pine Script
table.cell_set_text_color(table_id: series table, column: series int, row: series int, text_color: series color (optional)) -> void
table.cell_set_text_color(column: series int, row: series int, text_color: series color (optional)) -> void

Arguments

NameTypeDefaultDescription
table_idseries tablerequiredThe table that holds the cell whose text is recolored.
columnseries intrequiredColumn of the cell whose text color changes, counting from 0 at the left.
rowseries intrequiredRow of the cell whose text color changes, counting from 0 at the top.
text_colorseries colornaNew color for the text. The cell's fill, size and words are not touched.

Returns

Nothing.

Example

Pine ScriptGreen or red bar-to-bar changeOpen in editor
//@version=6
indicator("table.cell_set_text_color: change", overlay = true)
chg = close - close[1]
var t = table.new(position.top_right, 2, 1)
if barstate.islast
    table.cell(t, 0, 0, "Change")
    table.cell(t, 1, 0, str.tostring(chg, "#.##"))
    table.cell_set_text_color(t, 1, 0, chg >= 0 ? color.green : color.red)

See also

Runs on Sidechair