# Changing Report Table Text Colour Based on Value

**URL:** <https://forum.inductiveautomation.com/t/changing-report-table-text-colour-based-on-value/18306>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [June 5, 2018, 6:35pm UTC](https://forum.inductiveautomation.com/t/changing-report-table-text-colour-based-on-value/18306 "2018-06-05T18:35:21Z")\
**Posts on this page:** 1\
**Showing post:** 16

<div class="post-metadata">

**Author:** ![Ryan\_Shaw](https://avatars.discourse-cdn.com/v4/letter/r/dbc845/32.png) [@Ryan\_Shaw](https://forum.inductiveautomation.com/u/Ryan_Shaw)\
**Post date:** [January 3, 2024, 8:52pm UTC](https://forum.inductiveautomation.com/t/changing-report-table-text-colour-based-on-value/18306/16 "2024-01-03T20:52:56Z")

</div>

I am also trying to add background color dynamically to the rows being returned in my report. I tried setting up a script data source like such:

```auto
from java.awt import Color	
	
rawResults = data['SparePartsByMasterPart'].getCoreResults()
hasSpareParts = rawResults.getColumnAsList(rawResults.getColumnIndex('HasSpareParts'))
legendColor = [Color(255,204,204) if val is None else Color(240,240,240) for val in hasSpareParts]
newDS = system.dataset.addColumn(rawResults, legendColor, 'LegendColor', Color)
data['SparePartsWithColor'] = newDS

```

I get back the error

> WARN: Error invoking script.Traceback (most recent call last):  
> File "function:updateData", line 8, in updateData  
> TypeError: can't put element of type color in dataset."

Am I formatting this incorrectly, or is this related to the bug being discussed in [Can't use Color Datatype in Dataset tag anymore, error: 'Invalid DataType for Dataset.' - #7 by matthew.byars](https://forum.inductiveautomation.com/t/cant-use-color-datatype-in-dataset-tag-anymore-error-invalid-datatype-for-dataset/54978/7)? I am on 8.1.23.

---

_[View the full topic](https://forum.inductiveautomation.com/t/changing-report-table-text-colour-based-on-value/18306)._
