# Perspective table font color

**URL:** <https://forum.inductiveautomation.com/t/perspective-table-font-color/97817>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [October 28, 2024, 5:19am UTC](https://forum.inductiveautomation.com/t/perspective-table-font-color/97817 "2024-10-28T05:19:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrd](https://avatars.discourse-cdn.com/v4/letter/j/b9bd4f/32.png) [@jrd](https://forum.inductiveautomation.com/u/jrd)\
**Post date:** [October 28, 2024, 5:19am UTC](https://forum.inductiveautomation.com/t/perspective-table-font-color/97817/1 "2024-10-28T05:19:18Z")

</div>

I'm trying to change the fontColor of rows in a table using script  
I have tried setting 'fontColour' without success  
My script looks like:

```python
	def contrast_colour(rgb):
			rgb_values = rgb[rgb.find("(") + 1 : rgb.find(")")].split(",") # Extract the RGB values from the string
			r, g, b = map(int, rgb_values) # Convert string values to integers
			# Calculate the contrasting color
		 	cont_r, cont_g, cont_b = 255 - r, 255 - g, 255 - b
			cont_colour = "rgb({},{},{})".format(cont_r,cont_g,cont_b)
			return cont_colour
			
	lst = []
	try:
		value = [v for v in value if v['attribute'] == self.getSibling("tblAttributeSelector").props.selection.data[0].attribute]
		
		for row in value:
			display_colour = row['display_colour']
			r = {'value': {'attribute_value': row['attribute_value'] },

				 'style': {'backgroundColor': display_colour, 'fontColor': contrast_colour(display_colour)}
				 }
			lst.append(r)		 
		if len(lst) == 0:
			self.meta.visible = False
	except:
		pass
			
	return lst

```

Some advice would be appreciated  
Thanks

---

<div class="post-metadata">

**Author:** ![humphrey.daniel](https://avatars.discourse-cdn.com/v4/letter/h/8e8cbc/32.png) [@humphrey.daniel](https://forum.inductiveautomation.com/u/humphrey.daniel)\
**Post date:** [October 28, 2024, 6:46am UTC](https://forum.inductiveautomation.com/t/perspective-table-font-color/97817/2 "2024-10-28T06:46:23Z")

</div>

Might need to inspect the element to confirm the selector you need, but maybe you should try setting color.

> **[color - CSS: Cascading Style Sheets | MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/color)**
>
> The color CSS property sets the foreground color value of an element's text and text decorations, and sets the currentcolor value. currentcolor may be used as an indirect value on other properties and is the default for other color properties, such...

---

<div class="post-metadata">

**Author:** ![Transistor](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/transistor/32/3380_2.png) [@Transistor](https://forum.inductiveautomation.com/u/Transistor)\
**Post date:** [October 28, 2024, 8:42am UTC](https://forum.inductiveautomation.com/t/perspective-table-font-color/97817/3 "2024-10-28T08:42:49Z")

</div>

Some documentation on your code would be useful. What is the format of the input data and what do you want back.

As far as I'm aware, there is no "fontColor" CSS property. It's just "color".
