# Sp-button color styling through JS

**URL:** <https://forums.creativeclouddeveloper.com/t/sp-button-color-styling-through-js/5000>\
**Category:** UXP Plugin API\
**Created:** [July 22, 2022, 8:58pm UTC](https://forums.creativeclouddeveloper.com/t/sp-button-color-styling-through-js/5000 "2022-07-22T20:58:15Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ddbell](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/ddbell/32/1030_2.png) [@ddbell](https://forums.creativeclouddeveloper.com/u/ddbell)\
**Post date:** [July 22, 2022, 8:58pm UTC](https://forums.creativeclouddeveloper.com/t/sp-button-color-styling-through-js/5000/1 "2022-07-22T20:58:15Z")

</div>

I’m trying to change the colors for an sp-button based on the user input. So the button color will change based on one of their other selections. I can get the text color and background color to change. However, the border color doesn’t change. Also, the mouseover doesn’t work to change the mouseover background color.

Am I doing this wrong? Or is it not possible?

```auto
document.getElementById("myButtonID").style.backgroundColor="#30bf30"; //works
document.getElementById("myButtonID").style.color="#000000"; //works
document.getElementById("myButtonID").style.borderColor="#30bf30"; //doesn't work
document.getElementById("myButtonID").onmouseover=function(){this.style.backgroundColor="#35d435";} //doesn't work
document.getElementById("myButtonID").onmouseover=function(){document.getElementById("myButtonID").style.backgroundColor="#35d435";} //doesn't work

```

---

<div class="post-metadata">

**Author:** ![M3mber](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/m3mber/32/3216_2.png) [@M3mber](https://forums.creativeclouddeveloper.com/u/M3mber)\
**Post date:** [March 25, 2025, 5:46pm UTC](https://forums.creativeclouddeveloper.com/t/sp-button-color-styling-through-js/5000/2 "2025-03-25T17:46:37Z")

</div>

Did you manage to figure out how to solve this border color issue? I am running into the same thing

---

<div class="post-metadata">

**Author:** ![Karmalakas](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.creativeclouddeveloper.com/karmalakas/32/1048_2.png) [@Karmalakas](https://forums.creativeclouddeveloper.com/u/Karmalakas)\
**Post date:** [March 25, 2025, 6:09pm UTC](https://forums.creativeclouddeveloper.com/t/sp-button-color-styling-through-js/5000/3 "2025-03-25T18:09:00Z")

</div>

I assume it’s the same with `sp-action-button` and I don’t believe this was ever adressed. You might want to consider a workaround with absolute position of a pseudo-element:

> [@\<sp-action-button\> border is out of place and can't override color](https://forums.creativeclouddeveloper.com/t/sp-action-button-border-is-out-of-place-and-cant-override-color/3856/2):
>
> It’s a rounding issue that affects all layout; you can’t do anything about it until it’s fixed in UXP core. You’ll see similar issues in first-party features as well. Border colors are not configurable. You can use pseudo elements along w/ absolute & relative positioning to overwrite them: .yourButton { position: relative; } .yourButton:after { content: ''; position: absolute; top: -1px; right: -1px; bottom: -1px; left: -1px; border: 1px solid red; border-r…
