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
Родитель 22b8061a44
Коммит ce1d2147d7
1 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -218,13 +218,15 @@ function calendarInit()
var lightness = (max + min) / 2;
// 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
// #FF0000, #00FF00 and #0000FF still get black text which looked
// better when we tested this.
if (lightness < 120)
if (lightness < 120) {
gCalendarStyleSheet.insertRule("." + containerName + " { color:" + " white" + "!important;}", 1);
} else {
gCalendarStyleSheet.insertRule("." + containerName + " { color:" + " black" + "!important;}", 1);
}
var calListItem = calListItems[i+1];
if (calListItem && calListItem.childNodes[0]) {
calListItem.childNodes[0].setAttribute("class", "calendar-list-item-class " + containerName);