Is it possible to color the sections/tab?

SanjivMeher
Kilo Patron
Kilo Patron

I want to have different colors for each tab in my CMDB module. Is it possible to do so?


Please mark this response as correct or helpful if it assisted you with your question.
1 ACCEPTED SOLUTION

saisowmya
Giga Expert

Hi Sanjiv,



Hope you are asking something as below.


find_real_file.png





You can achieve this by writing a on load client script on your table:



Script:


function onLoad() {


    //Type appropriate comment here, and begin script below


var tabs = document.getElementsByClassName('tabs2_tab');


tabs[0].style.backgroundColor = 'red';


tabs[1].style.backgroundColor = 'green';


tabs[2].style.backgroundColor = 'orange';


tabs[3].style.backgroundColor = 'blue';


tabs[4].style.backgroundColor = 'yellow';



}



section numbers starts from 0. Replace the tab number with your required number to add color to that particular tab/section.



If you want to add colors to related lists as below , the next number will be followed in the script.


find_real_file.png




Please mark the answer as correct, if your issue is resolved


View solution in original post

11 REPLIES 11

I was wondering the same thing.

Nicholas Frang2
Kilo Contributor

As you can see in this thread, there are ways to change tab colours with script. However, keep in mind that this is not inline with best practice. DOM manipulation is not recommended in ServiceNow since future UI upgrades are sure to break the script.

That said, there are many factors as to why this may or may not be a good idea. I would say go for it,  as long as you keep in mind the cost and risk of maintaining this type of script.