[Bug-1512] Perspective PieChart legendLabelColor Themes

Currently using 8.1.17, the legendLabelColor doesn’t appear to honor built in themes. Changing themes, from light to dark, for example, the color always remains black. I can change the color using a picker and that color will reflect. I tried something like --neutral-100 but that doesn’t seem to change anything either. I did see one post, Perspective pie labels obscured - #2 by cmallonee, that states this component relies on a 3rd party library. Does that mean we are out of luck on this?

See if XYChart backgroundColor not changing with Theme - #2 by Transistor is of any assistance.

Don’t think so. It’s not that I’m setting the wrong property, that is the property.

Pie chart theme

What I’ve done when faced with supporting themes is:

  1. Create an object `session.custom.AMChartsCssVars with structure shown below.
  "legendLabelColor_Light": "#101010",
  "legendLabelColor_Dark": "#e0e0e0"

Now wherever you need to flip the color add the following binding:

if(left({session.props.theme}, 4) = "dark",

This works fine as long as the first four letters of your dark them are “dark”. Setting the colors in the session variables means that you can apply site-wide customisation in a jiffy.

This approach defeats the purpose of using css themes though.
You should look at the chart in the browser dev tools when it’s running and see what colour the text is being assigned to. Then you can know why it’s not changing and resolve it properly using css