# Extract property from style class in Perspective

**URL:** <https://forum.inductiveautomation.com/t/extract-property-from-style-class-in-perspective/32165>\
**Category:** Ignition\
**Tags:** perspective\
**Created:** [February 12, 2020, 2:59pm UTC](https://forum.inductiveautomation.com/t/extract-property-from-style-class-in-perspective/32165 "2020-02-12T14:59:59Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![tjsykora](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@tjsykora](https://forum.inductiveautomation.com/u/tjsykora)\
**Post date:** [February 12, 2020, 2:59pm UTC](https://forum.inductiveautomation.com/t/extract-property-from-style-class-in-perspective/32165/1 "2020-02-12T14:59:59Z")

</div>

Currently I am using some icons as buttons and as far as I can tell the only way to change the icon’s color is to change the ‘color’ property, which is unfortunately outside of the style prop. Is it possible to extract a property from a style class that I set up in Perspective to make things easier for me to keep my icons within my theme, or is my best bet going to be creating a few session props with the colors I want and binding my icon colors to that? Perhaps I am overlooking something much simpler?

---

<div class="post-metadata">

**Author:** ![joostjojo](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@joostjojo](https://forum.inductiveautomation.com/u/joostjojo)\
**Post date:** [February 12, 2020, 3:19pm UTC](https://forum.inductiveautomation.com/t/extract-property-from-style-class-in-perspective/32165/2 "2020-02-12T15:19:01Z")

</div>

You mean setting a style you can use for more icons?

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

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/f/fbe2e991a00da41b783a6ebcbf288187edaa18b4.png)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/4/4a9b008be28dcd033a60fe52dd6b910e1722c82c.png)

---

<div class="post-metadata">

**Author:** ![tjsykora](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@tjsykora](https://forum.inductiveautomation.com/u/tjsykora)\
**Post date:** [February 12, 2020, 3:43pm UTC](https://forum.inductiveautomation.com/t/extract-property-from-style-class-in-perspective/32165/3 "2020-02-12T15:43:26Z")

</div>

Yes, except the Stroke color which you are using there will only create an outline of the shape, but I want a way to change the main color of the shape (like how this icon is red)  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/2/293a63800a497566cd339061ffdc69d93b353f98.png)  
Ideally I would be able to bind the color of the icon to the background color in the style class I use for my buttons, so if I change the color it will propagate to all my buttons, as well as my icon “buttons”, and I only have to change it in 1 place.

---

<div class="post-metadata">

**Author:** ![NorthPoint](https://avatars.discourse-cdn.com/v4/letter/n/a88e4f/32.png) [@NorthPoint](https://forum.inductiveautomation.com/u/NorthPoint)\
**Post date:** [March 10, 2020, 6:31pm UTC](https://forum.inductiveautomation.com/t/extract-property-from-style-class-in-perspective/32165/4 "2020-03-10T18:31:29Z")

</div>

Bumping this- has anyone received an answer? I also would like to drive icon fill color with style classes.

---

<div class="post-metadata">

**Author:** ![kirsten.chambers](https://avatars.discourse-cdn.com/v4/letter/k/48db29/32.png) [@kirsten.chambers](https://forum.inductiveautomation.com/u/kirsten.chambers)\
**Post date:** [March 10, 2020, 7:11pm UTC](https://forum.inductiveautomation.com/t/extract-property-from-style-class-in-perspective/32165/5 "2020-03-10T19:11:54Z")

</div>

You can directly use a style class’s `shape.fill` to alter the color of icons–the missing ingredient here is that you must ensure the `props.color` property of the icon is **blank** for the style sheet to take effect, like so:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/197af7c4485c3974b08678b603077eb0b8995193.png)

The `props.color` property seems to be an inline override of the applied style sheet under the hood, so if it’s not empty, your style gets overwritten.

---

<div class="post-metadata">

**Author:** ![tjsykora](https://avatars.discourse-cdn.com/v4/letter/t/b2d939/32.png) [@tjsykora](https://forum.inductiveautomation.com/u/tjsykora)\
**Post date:** [March 10, 2020, 7:20pm UTC](https://forum.inductiveautomation.com/t/extract-property-from-style-class-in-perspective/32165/6 "2020-03-10T19:20:25Z")

</div>

That works! Looks like deleting the color prop all together doesn’t work, but having an empty color prop works great. Thanks!

---

<div class="post-metadata">

**Author:** ![wking](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/wking/32/21823_2.png) [@wking](https://forum.inductiveautomation.com/u/wking)\
**Post date:** [May 27, 2020, 5:01pm UTC](https://forum.inductiveautomation.com/t/extract-property-from-style-class-in-perspective/32165/7 "2020-05-27T17:01:46Z")

</div>

For future readers. This took me a min to figure out.

 ![icon fade](https://us1.discourse-cdn.com/inductiveautomation/original/2X/5/52e4ba774c67627d5c5584ca92b520821c823d67.jpeg)

CSS is great: [CSS Transitions](https://www.w3schools.com/css/css3_transitions.asp)
