Make calendar text readable in light-on-dark themes (bug 266186); r=mostafah

This commit is contained in:
dmose%mozilla.org 2004-10-27 21:29:35 +00:00
parent 22b8061a44
commit ce1d2147d7

View File

@ -218,13 +218,15 @@ function calendarInit()
var lightness = (max + min) / 2; var lightness = (max + min) / 2;
// Consider all colors with less than 50% Lightness as dark colors // Consider all colors with less than 50% Lightness as dark colors
// and use white as the foreground color. // and use white as the foreground color; otherwise use black.
// Actually we use a treshold a bit below 50%, so colors like // Actually we use a treshold a bit below 50%, so colors like
// #FF0000, #00FF00 and #0000FF still get black text which looked // #FF0000, #00FF00 and #0000FF still get black text which looked
// better when we tested this. // better when we tested this.
if (lightness < 120) if (lightness < 120) {
gCalendarStyleSheet.insertRule("." + containerName + " { color:" + " white" + "!important;}", 1); gCalendarStyleSheet.insertRule("." + containerName + " { color:" + " white" + "!important;}", 1);
} else {
gCalendarStyleSheet.insertRule("." + containerName + " { color:" + " black" + "!important;}", 1);
}
var calListItem = calListItems[i+1]; var calListItem = calListItems[i+1];
if (calListItem && calListItem.childNodes[0]) { if (calListItem && calListItem.childNodes[0]) {
calListItem.childNodes[0].setAttribute("class", "calendar-list-item-class " + containerName); calListItem.childNodes[0].setAttribute("class", "calendar-list-item-class " + containerName);