Recolors the text of one cell without changing its fill, size or wording.
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
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)) -> voidArguments
| Name | Type | Default | Description |
|---|---|---|---|
| table_id | series table | required | The table that holds the cell whose text is recolored. |
| column | series int | required | Column of the cell whose text color changes, counting from 0 at the left. |
| row | series int | required | Row of the cell whose text color changes, counting from 0 at the top. |
| text_color | series color | na | New color for the text. The cell's fill, size and words are not touched. |
Returns
Nothing.
Example
//@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