$(document).ready(function() {
$('.cat-item').each(function() {
var colorArray = ['blue', 'violet', 'yellow', 'red', 'green', 'grey'];
var listGroup = document.getElementById('list-group1');
if ($(this).hasClass('active')) {
listGroup.style.background = (colorArray[$(this).index()]);
}
});
});