# How to use Extension Function getForegroundAt?

**URL:** <https://forum.inductiveautomation.com/t/how-to-use-extension-function-getforegroundat/58071>\
**Category:** Ignition\
**Tags:** ignition79, scripting\
**Created:** [April 5, 2022, 9:00pm UTC](https://forum.inductiveautomation.com/t/how-to-use-extension-function-getforegroundat/58071 "2022-04-05T21:00:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SOPerator](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@SOPerator](https://forum.inductiveautomation.com/u/SOPerator)\
**Post date:** [April 5, 2022, 9:00pm UTC](https://forum.inductiveautomation.com/t/how-to-use-extension-function-getforegroundat/58071/1 "2022-04-05T21:00:13Z")

</div>

I’m writing a script for a table but I haven’t been able to understand how the getForegroundAt function works. Does it work for individual rows/cells? Or will it only ever return for the entire component? My current script looks like this

```auto
	for i in range (20):
		
		currValue = self.data.getValueAt(i, 2)
		if currValue in deprecatedValues: #deprecatedValues is an array of values
			return {'foreground': '#EAE6E6'}
		else:
			return defaultColor

```

But it returns the text color for the entire component, is it possible to return for only one row at a time using the table component? (I’m not looking to use power tables, which I know have this functionality)

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 5, 2022, 9:17pm UTC](https://forum.inductiveautomation.com/t/how-to-use-extension-function-getforegroundat/58071/2 "2022-04-05T21:17:48Z")

</div>

Don’t iterate. The component does the iteration and calls the function for you, separately, for each visible cell. You provide the answer for the row and column that the component is asking for.

Don’t do _ **anything** _ in these functions that gets non-local data (like from the gateway). A callout across the network will crush your display.

---

<div class="post-metadata">

**Author:** ![SOPerator](https://avatars.discourse-cdn.com/v4/letter/s/838e76/32.png) [@SOPerator](https://forum.inductiveautomation.com/u/SOPerator)\
**Post date:** [April 5, 2022, 9:32pm UTC](https://forum.inductiveautomation.com/t/how-to-use-extension-function-getforegroundat/58071/3 "2022-04-05T21:32:28Z")

</div>

Thanks, between this advice and doing `return 'gray'` instead of my previous return, I got it to do what I needed!

---

<div class="post-metadata">

**Author:** ![AJBerera](https://avatars.discourse-cdn.com/v4/letter/a/9fc29f/32.png) [@AJBerera](https://forum.inductiveautomation.com/u/AJBerera)\
**Post date:** [October 11, 2022, 6:51pm UTC](https://forum.inductiveautomation.com/t/how-to-use-extension-function-getforegroundat/58071/4 "2022-10-11T18:51:28Z")

</div>

Is there an equivalent function that can be used for a power table?

Edit:

The answer is yes, using ConfigureCell

```auto
	if selected:
		background = self.selectionBackground
		foreground = self.selectionForeground
	elif rowView % 2 == 0:
		background = 'white'
		foreground = 'black'
	else:
		background = '#FFFFCC'
		foreground = 'black'
	
	currValue = self.data.getValueAt(rowView,'EventPassed')
	if currValue != True:
		foreground = 'red'

	return {'foreground': foreground,'background': background}

```
