In the hooks/<tablename>-dv.js:
Assuming your selection is “empty, yes, no” otherwise you need to adjust the below code accordingly.
Replace YOURSELECTNAME by your selection.
$j(function () {
var onSelectOpen=function(){
$j(".select2-drop-active .select2-result-selectable:eq(0)").css("color","")
$j(".select2-drop-active .select2-result-selectable:eq(1)").css("color","green")
$j(".select2-drop-active .select2-result-selectable:eq(2)").css("color","red")
}
var onSelectClose=function(){
var myval=$j("#YOURSELECTNAME").val();
switch(myval) {
case "yes":
$j("#s2id_YOURSELECTNAME .select2-choice").css("color","green")
break;
case "no":
$j("#s2id_YOURSELECTNAME .select2-choice").css("color","red")
break;
default:
$j("#s2id_YOURSELECTNAME .select2-choice").css("color","")
}
}
$j("#YOURSELECTNAME").on("select2-open", onSelectOpen);
$j("#YOURSELECTNAME").on("select2-close", onSelectClose);
}