# \[SOLVED\] How to set a button border color dynamically?

**URL:** <https://forum.inductiveautomation.com/t/solved-how-to-set-a-button-border-color-dynamically/40508>\
**Category:** Ignition\
**Tags:** vision, scripting, ignition80\
**Created:** [November 10, 2020, 8:53pm UTC](https://forum.inductiveautomation.com/t/solved-how-to-set-a-button-border-color-dynamically/40508 "2020-11-10T20:53:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [November 10, 2020, 8:53pm UTC](https://forum.inductiveautomation.com/t/solved-how-to-set-a-button-border-color-dynamically/40508/1 "2020-11-10T20:53:35Z")

</div>

Good afternoon,

How would I set a vision button’s border dynamically? The following expression works fine.

```
toBorder("matte;'0, 255, 255';5;5;5;5")

```

However this does not work fine

```
toBorder("matte;{tagPath};5;5;5;5")

```

This also doesn’t work…

```
toBorder("matte;runScript('myScript.getColor()');5;5;5;5")

```

Thanks for any input.

---

<div class="post-metadata">

**Author:** ![jcoffman](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/jcoffman/32/6429_2.png) [@jcoffman](https://forum.inductiveautomation.com/u/jcoffman)\
**Post date:** [November 10, 2020, 9:07pm UTC](https://forum.inductiveautomation.com/t/solved-how-to-set-a-button-border-color-dynamically/40508/2 "2020-11-10T21:07:49Z")

</div>

you should be able to do it with something like this: `toBorder("matte;" + {tagPath} + ";5;5;5;5")`

---

<div class="post-metadata">

**Author:** ![bmeyers](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/bmeyers/32/37453_2.png) [@bmeyers](https://forum.inductiveautomation.com/u/bmeyers)\
**Post date:** [November 10, 2020, 9:32pm UTC](https://forum.inductiveautomation.com/t/solved-how-to-set-a-button-border-color-dynamically/40508/3 "2020-11-10T21:32:23Z")

</div>

I followed your suggestion and also added a custom property called myColor with the following expression binding:

```
runScript('myScript.getColor()')

```

And then using your syntax:

```
toBorder("matte;" + {component.customPropertyPath} + ";5;5;5;5")

```

And it works!  
Thanks!
