CC-4101Calendar displays white on white for certain show names, making shows invisible

This commit is contained in:
Martin Konecny 2012-07-13 10:28:50 -04:00
parent 8f6d6058a2
commit 8dcb1f8f3d
1 changed files with 10 additions and 0 deletions

View File

@ -118,6 +118,14 @@ function stringToColor(s)
return intToRGB(hashCode(s));
}
function getContrastYIQ(hexcolor){
var r = parseInt(hexcolor.substr(0,2),16);
var g = parseInt(hexcolor.substr(2,2),16);
var b = parseInt(hexcolor.substr(4,2),16);
var yiq = ((r*299)+(g*587)+(b*114))/1000;
return (yiq >= 128) ? '000000' : 'ffffff';
}
function setAddShowEvents() {
@ -578,9 +586,11 @@ function setAddShowEvents() {
}
var bgColorEle = $("#add_show_background_color");
var textColorEle = $("#add_show_color");
$('#add_show_name').bind('input', 'change', function(){
var colorCode = stringToColor($(this).val());
bgColorEle.val(colorCode);
textColorEle.val(getContrastYIQ(colorCode));
});
}