Improved contrast for highlighted and today's delegate

This commit is contained in:
Sebastian Kügler 2014-02-21 01:22:24 +01:00
parent 29cf8e22d2
commit 13ec787302

View File

@ -19,7 +19,6 @@ import QtQuick 2.0
import org.kde.plasma.calendar 2.0 import org.kde.plasma.calendar 2.0
import org.kde.plasma.core 2.0 as PlasmaCore import org.kde.plasma.core 2.0 as PlasmaCore
import org.kde.plasma.components 2.0 as Components import org.kde.plasma.components 2.0 as Components
import org.kde.plasma.extras 2.0 as PlasmaExtras
Item { Item {
@ -28,6 +27,7 @@ Item {
height: cellHeight height: cellHeight
property real borderOpacity: daysCalendar.borderOpacity property real borderOpacity: daysCalendar.borderOpacity
property bool today: isToday(new Date(yearNumber, monthNumber - 1, dayNumber))
Rectangle { Rectangle {
id: todayRect id: todayRect
@ -35,9 +35,13 @@ Item {
y: 0 y: 0
width: parent.width - (borderWidth) width: parent.width - (borderWidth)
height: parent.height - (borderWidth) height: parent.height - (borderWidth)
opacity: isToday(new Date(yearNumber, monthNumber - 1, dayNumber)) ? 0.8 : 0 opacity: {
Behavior on opacity { NumberAnimation {} } if (calendarDays.selectedItem == dayStyle && today) 0.6
color: theme.highlightColor else if (today) 0.4
else 0
}
Behavior on opacity { NumberAnimation { duration: units.shortDuration*2 } }
color: theme.textColor
} }
Rectangle { Rectangle {
@ -47,12 +51,12 @@ Item {
} }
opacity: { opacity: {
if (calendarDays.selectedItem == dayStyle) 0.6 if (calendarDays.selectedItem == dayStyle) 0.6
else if (dateMouse.containsMouse) 0.3 else if (dateMouse.containsMouse) 0.4
else 0 else 0
} }
//visible: dateMouse.containsMouse visible: !today
Behavior on opacity { NumberAnimation {} } Behavior on opacity { NumberAnimation { duration: units.shortDuration*2 } }
color: theme.viewBackgroundColor color: theme.highlightColor
z: todayRect.z - 1 z: todayRect.z - 1
} }
@ -87,8 +91,8 @@ Item {
anchors.centerIn: parent anchors.centerIn: parent
font.pixelSize: Math.max(theme.defaultFont.pixelSize, cellHeight / 3) font.pixelSize: Math.max(theme.defaultFont.pixelSize, cellHeight / 3)
text: dayNumber text: dayNumber
//font.bold: (containsEventItems)||(containsTodoItems) ? true: false
opacity: (isPreviousMonth || isNextMonth) ? 0.5: 1.0 opacity: (isPreviousMonth || isNextMonth) ? 0.5: 1.0
color: today ? theme.backgroundColor : theme.textColor
} }