diff --git a/src/kdatetable.cpp b/src/kdatetable.cpp --- a/src/kdatetable.cpp +++ b/src/kdatetable.cpp @@ -54,6 +54,7 @@ void endOfMonth(); void beginningOfWeek(); void endOfWeek(); + QColor appropriateRedColor(QColor backgroundColor); KDateTable *q; @@ -274,12 +275,13 @@ if (row == 0) { //We are drawing a header cell + cellBackgroundColor = palette().color(QPalette::Window); //If not a normal working day, then use "do not work today" color if (workingDay) { cellTextColor = palette().color(QPalette::WindowText); } else { - cellTextColor = Qt::darkRed; + cellTextColor = d->appropriateRedColor(cellBackgroundColor); } cellBackgroundColor = palette().color(QPalette::Window); @@ -366,7 +368,7 @@ //If the cell day is the day of religious observance, then always color text red unless Custom overrides if (! customDay && dayOfPray) { - cellTextColor = Qt::darkRed; + cellTextColor = d->appropriateRedColor(cellBackgroundColor); } } @@ -454,6 +456,16 @@ q->setDate(m_date.addDays(7 - m_date.dayOfWeek())); } +QColor KDateTable::KDateTablePrivate::appropriateRedColor(QColor backgroundColor) +{ + if (backgroundColor.lightnessF() < 0.3) { + return Qt::red; + } else { + return Qt::red; + } +} + + void KDateTable::keyPressEvent(QKeyEvent *e) { switch (e->key()) {