# How to change cell color in message handler

**URL:** <https://forum.inductiveautomation.com/t/how-to-change-cell-color-in-message-handler/52130>\
**Category:** Ignition\
**Created:** [October 19, 2021, 8:11pm UTC](https://forum.inductiveautomation.com/t/how-to-change-cell-color-in-message-handler/52130 "2021-10-19T20:11:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkhoshroo](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pkhoshroo/32/26801_2.png) [@pkhoshroo](https://forum.inductiveautomation.com/u/pkhoshroo)\
**Post date:** [October 19, 2021, 8:11pm UTC](https://forum.inductiveautomation.com/t/how-to-change-cell-color-in-message-handler/52130/1 "2021-10-19T20:11:45Z")

</div>

Hello All,

I am trying to change the color of a specific cell (process\_value) based on the value of two columns (low limit, high limit). I have the script below in the message handler. However, with this script the whole table change its color to green/red (defined color style). How should I change this to be able to change the desired cell color and not the whole table color? Thank you!

```auto
	specLL = pds.getValueAt(row,"low_limit")
	specHL = pds.getValueAt(row,"high_limit")

	if value != "":
		# Spec value is a float Process Value
		if col == "process_value":
			value = float(value)
			pds = system.dataset.setValue(pds, row,col,value)
			
			# evaluate the result
			if value <= specHL and value >= specLL:
				self.props.cells.style.classes="CellColor/green"
			else:
				self.props.cells.style.classes="CellColor/red"
	
		# UPDATE DATASET
		self.view.custom.part.spec.data = pds

```

I guess my question then would be how to apply color to this cell?

`pds.getValueAt(row,col)`

---

<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:** [October 19, 2021, 8:48pm UTC](https://forum.inductiveautomation.com/t/how-to-change-cell-color-in-message-handler/52130/2 "2021-10-19T20:48:33Z")

</div>

Because you’re setting the very general-scoped `cells` styling, which is used as the “default” for any cells which don’t have their own style attributes defined in `props.data`. You need to set the style for just one cell of data in `props.data` by modifying the `style` attribute of some “cell”. I’ve assisted with that ina. neighboring thread: [Change style of cell (component Table) via script - Perspective - #13 by cmallonee](https://forum.inductiveautomation.com/t/change-style-of-cell-component-table-via-script-perspective/44573/13)

You shouldn’t be handling the logic like this.

What I recommend is you place all of the display logic into the table. If you need to update a value in the dataset, feel free to do so wherever, but let the Table itself resolve the binding and apply the display logic based on the new values.
