The jQuery UI execution line does not have an explicit color set; instead, it inherits the background image of the "widget title" from your user interface theme. The easiest way to change the color is to customize the styles that override the background. For instance:
.ui-progressbar.beginning .ui-progressbar-value { background: red; } .ui-progressbar.middle .ui-progressbar-value { background: yellow; } .ui-progressbar.end .ui-progressbar-value { background: green; }
(Alternatively, you can use different background images.) Then you simply change the class in the progress bar while adjusting its value:
function updateProgressbar(current, target) { var value = parseInt(current / target * 100); $progressbar .progressbar("value", value) .removeClass("beginning middle end") .addClass(value < 40 ? "beginning" : value < 80 ? "middle" : "end"); }
Working example.
source share