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:
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