# Changing colour of row based off value in cell in perspective table

**URL:** <https://forum.inductiveautomation.com/t/changing-colour-of-row-based-off-value-in-cell-in-perspective-table/43587>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 18, 2021, 7:51pm UTC](https://forum.inductiveautomation.com/t/changing-colour-of-row-based-off-value-in-cell-in-perspective-table/43587 "2021-02-18T19:51:52Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![cmallonee](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmallonee/32/6416_2.png) [@cmallonee](https://forum.inductiveautomation.com/u/cmallonee)\
**Post date:** [February 18, 2021, 8:52pm UTC](https://forum.inductiveautomation.com/t/changing-colour-of-row-based-off-value-in-cell-in-perspective-table/43587/2 "2021-02-18T20:52:54Z")

</div>

If you want to style individual cells or even a row based off of a value within a row, then you need to provide that as part of the data. The default data in the Table has a simple application of this which you can see for the city of Folsom.

You will want to manipulate your data so that each cell contains a style object, which in turn contains a property key of `backgroundColor`, where this property has the color you want the cell to have. If you want a cell to not have any additional background, you can leave the cell as a simple value.

In this example, you can see that I’ve kept the original orange background for my `city` cell, but Ive added a green background to my `country` cell by providing the cell’s data as an object with `value` as a key (which is where the displayed value should go) and a `style` object with an internal `backgroundColor` property.

 ![Screen Shot 2021-02-18 at 12.39.08PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/7/27290015c22405189e41cf705b6f29afeaf0c2c5.png)  
I usually include a transform on whatever binding I’m using for my Table data:

```auto
	returned_rows = []
	for row in value:
		row_dict = {}
		row_dict['country'] = row.country
		row_dict['city'] = row.city
		population = row.population
		if int(population) < 3000000:
			population = {'value': population, 'style': {'backgroundColor': '#00FF00'}}
		row_dict['population']= population
		returned_rows.append(row_dict)
	return returned_rows

```

This allows for easy highlighting of values which match a condition:

 ![Screen Shot 2021-02-18 at 12.52.40PM](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/a/2a0ce5955721431e8028ce246bc996c1ccf59e6d.png)

---

_[View the full topic](https://forum.inductiveautomation.com/t/changing-colour-of-row-based-off-value-in-cell-in-perspective-table/43587)._
