Perhaps you will probably save the list of colors in an array first.
Then you can bind the change () handler for the selection options, for example:
HTML:
<select id="products">
<option value="0">Blue</option>
<option value="1">Black</option>
<option value="2">Red</option>
</select>
If you have an associative array, you can replace the numbers with keys.
Then in JavaScript you can do the following:
$('#products').change(function() {
$("option:selected", $(this)).each(function() {
var index = $(this).val();
$(this).css('backgroundColor', colorList[index]);
});
})
where colorList is an array of colors.