how to change the button color?

alvatindra
Giga Contributor

I want to change the color of   all buttons with in the instance.

How this can be done?

9 REPLIES 9

Chuck Tomasi
Tera Patron

If you are using Geneva or later with UI16, you should go to System UI> Themes



Create or customize a theme


Chuck,


I want to change the button colors only on my application and not universally. To change header we would need to edit heisenberg theme and that would impact the entire server. Not ideal.


ServiceNow have a supported way to configure button colors at present.



I invite you to open an enhancement request! Our product managers DO listen.


Enhancement requests: Tell us how you would improve the ServiceNow product


var items = document.getElementsByTagName('button');


for(var i=0;i<items.length;i++){    


    if(items[i].innerHTML.indexOf('Add') > -1){    


      items[i].style.backgroundColor = "#32CD32";


      items[i].style.color = "#FFFFFF";


      }


    if(items[i].innerHTML.indexOf('Add Types') > -1){  


  items[i].style.backgroundColor = "#32CD32";    


  items[i].style.color = "#FFFFFF";


      }


  if(items[i].innerHTML.indexOf('Submit') > -1){  


  items[i].style.backgroundColor = "#32CD32";    


  items[i].style.color = "#FFFFFF";


      }  



}



We use above on load client script to change the color of the button.


shloke04
Kilo Patron

Hi,



Below links may be useful:



https://www.servicenowguru.com/scripting/client-scripts-scripting/change-form-button-color/


Set Colour of Unique Form Button



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke