# Scripting Cell color in a Power Table

**URL:** <https://forum.inductiveautomation.com/t/scripting-cell-color-in-a-power-table/76978>\
**Category:** Ignition\
**Tags:** scripting\
**Created:** [July 26, 2023, 10:20pm UTC](https://forum.inductiveautomation.com/t/scripting-cell-color-in-a-power-table/76978 "2023-07-26T22:20:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shirshak\_Chhetri](https://avatars.discourse-cdn.com/v4/letter/s/c89c15/32.png) [@Shirshak\_Chhetri](https://forum.inductiveautomation.com/u/Shirshak_Chhetri)\
**Post date:** [July 26, 2023, 10:20pm UTC](https://forum.inductiveautomation.com/t/scripting-cell-color-in-a-power-table/76978/1 "2023-07-26T22:20:00Z")

</div>

Hello All,

I am having a hard time coming up with a proper script and integrating it and wanted some guide.  
I have a power table and have four custom properties binded to it.  
 ![Snap9](https://us1.discourse-cdn.com/inductiveautomation/original/3X/6/4/64176c1b1461e3706eb143ac83285f6891bb444c.png)

First, I wanted to highlight a single cell in the third column based on the PartName.  
 ![Snap8](https://us1.discourse-cdn.com/inductiveautomation/original/3X/b/4/b43392becbc7205a522cf0351ebdfb8d29872f75.png)

But the script I am using highlights the whole row.

```auto
if self.PartName == self.data.getValueAt(rowIndex, "Seed Tube Part Number"):
		return {'background': 'Green', 'foreground': 'white'}
	else:
		pass

```

Also, if the Current program number matches any data in the first column and the Pass property is true, I want to highlight that particular cell as well. I don't know how to write a program for this part and integrate with the first script. Any help would be greatly appreciated. Thanks.

---

<div class="post-metadata">

**Author:** ![JGJohnson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jgjohnson/32/29582_2.png) [@JGJohnson](https://forum.inductiveautomation.com/u/JGJohnson)\
**Post date:** [July 26, 2023, 10:31pm UTC](https://forum.inductiveautomation.com/t/scripting-cell-color-in-a-power-table/76978/2 "2023-07-26T22:31:53Z")

</div>

Something like this should do it.

This

```auto
    else:
        pass

```

is not necessary.

```auto
attributes = {'background': 'White', 'foreground': 'Black'}
if self.PartName == self.data.getValueAt(rowIndex, "Seed Tube Part Number"):
        attributes['background'] = 'Green'
        attributes['foreground'] = 'White'
if colName == "Int Column" and value == self.CurrentProgramNumber:
        attributes['background'] = 'Yellow'
        attributes['foreground'] = 'Black'

return attributes

```
