Found the following, https://stackoverflow.com/questions/3942878/how-to-decide-font-color-in-white-or-black-depending-on-background-color, it works well enough for what I need.
Have a custom property LightDark which is bound to Foreground Color and uses the simple color map.
if event.propertyName == "background":
color = event.source.background
r = color.getRed()
g = color.getGreen()
b = color.getBlue()
if (r*0.299 + g*0.587 + b*0.114) > 186:
event.source.parent.LightDark = 0 #Black
event.source.parent.LightDark = 1 #White
My issue on getLuminance() is that it’s getLightness(), was looking at wrong docs, IA support pointed that out to me. But, didn’t really need it though.