# Theme color variables in Piechart are not supported?

**URL:** <https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360>\
**Category:** Ignition\
**Tags:** ignition81, perspective\
**Created:** [January 25, 2022, 3:44pm UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360 "2022-01-25T15:44:14Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [January 25, 2022, 3:44pm UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360/1 "2022-01-25T15:44:14Z")

</div>

I try to use a theme color variable in PieChart component.

```auto
--variable-name

```

in colors array seems no to be supported ?

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/8/288b93e6b69d1d47b589ddf898306c59e668f827.png)

---

<div class="post-metadata">

**Author:** ![thewebpleb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/thewebpleb/32/27415_2.png) [@thewebpleb](https://forum.inductiveautomation.com/u/thewebpleb)\
**Post date:** [January 25, 2022, 3:48pm UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360/2 "2022-01-25T15:48:19Z")

</div>

Try using `var(--byes-alarmeFaible)`. See [here](https://developer.mozilla.org/en-US/docs/Web/CSS/Using_CSS_custom_properties) for CSS `var()` doc.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [January 25, 2022, 3:50pm UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360/3 "2022-01-25T15:50:20Z")

</div>

it dosen’t works for me: error **does not match the format for color**

---

<div class="post-metadata">

**Author:** ![thewebpleb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/thewebpleb/32/27415_2.png) [@thewebpleb](https://forum.inductiveautomation.com/u/thewebpleb)\
**Post date:** [January 27, 2022, 11:06pm UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360/4 "2022-01-27T23:06:57Z")

</div>

You’re right… I didn’t look into this before answering. In general, to use CSS variables, you _do_ need to use `var(--my-var)` notation (specifically, the `var(...)` part).

However, in this case, there is a limitation in the chart implementation Ignition is using (amCharts). As far as I can tell from reading their [docs](https://www.amcharts.com/docs/v5/reference/color_module/) and Stack Overflow, you can’t use variables to specify colors, which is very annoying. Depending on how badly you want to get this to work, you can target each slice of the pie by its DOM ID and then style it, which will be clunky, in my opinion.

Another option would be to use the excellent [Kyvis Labs](https://github.com/Kyvis-Labs/ignition-apexcharts-module) charting module. You can easily specify slice colors with CSS variables using this module.

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/d/1/d133767de11e5761cdb1d544b25d77c1e578daf6.png)

I apologize for misleading you initially…

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [January 28, 2022, 11:20am UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360/5 "2022-01-28T11:20:54Z")

</div>

Thanks @thewebpleb for the workaround !  
Do you know if there is a way to bind the theme variable ou read those variable with script or expression ?  
(without reading the file on the gateway…)

That could be usefull to obtain the string with the Hex code for the pie chart colors or other use case.

---

<div class="post-metadata">

**Author:** ![mazeyrat](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mazeyrat/32/10955_2.png) [@mazeyrat](https://forum.inductiveautomation.com/u/mazeyrat)\
**Post date:** [January 28, 2022, 5:05pm UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360/6 "2022-01-28T17:05:30Z")

</div>

@paul-griffith, Any idea how to read theme variable from the perspective script to obtain the string with the hex color value .  
Not sure it’s possible as the script are gatewau scoped and the variable perhaps only used in the browser scope ?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 28, 2022, 6:08pm UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360/7 "2022-01-28T18:08:40Z")

</div>

I don’t think it is possible at the moment.

---

<div class="post-metadata">

**Author:** ![benp](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/benp/32/34073_2.png) [@benp](https://forum.inductiveautomation.com/u/benp)\
**Post date:** [July 12, 2022, 3:58am UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360/8 "2022-07-12T03:58:05Z")

</div>

Hi @thewebpleb,

Can you develop a bit more your work, around I didn’t get it.  
I have the same issue with my gauge and XYchart components.  
I want the color to change depending on the component data value but I can’t find how to make it take my css variables.

Keep up the tutorial videos ! 👍

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/c/2/c2c889a4d0919c640c76e23529dd09f09e641d37.png)

![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/8/6/868b7bcaa723373b0201f8c43b5350dab89c0287.png)

---

<div class="post-metadata">

**Author:** ![thewebpleb](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/thewebpleb/32/27415_2.png) [@thewebpleb](https://forum.inductiveautomation.com/u/thewebpleb)\
**Post date:** [September 1, 2022, 6:37pm UTC](https://forum.inductiveautomation.com/t/theme-color-variables-in-piechart-are-not-supported/55360/9 "2022-09-01T18:37:18Z")

</div>

Hi Ben,

Sorry for the late reply… Is that map transform on the `arc.color` property? If you’re asking whether you can use variables for your XY Chart and/or Gauge colors, it looks like that isn’t supported by IA (actually, by the charts library they’re using).
