Add more color to Calendar events

This commit is contained in:
Vyn 2024-04-21 11:18:00 +02:00
parent d27cf89eee
commit 01037b1717
2 changed files with 15 additions and 3 deletions

View file

@ -243,5 +243,8 @@ QVariant Backend::getFiles()
QString Backend::getTagColor(QString tag) QString Backend::getTagColor(QString tag)
{ {
if (!tagsConfig.contains(tag)) {
return "#c6d0f5"; // TODO: currently hard coded but should match the default Text color.
}
return tagsConfig[tag]; return tagsConfig[tag];
} }

View file

@ -138,14 +138,20 @@ ColumnLayout {
property string name: modelData.text property string name: modelData.text
property int startTime: parseInt(modelData.startTime) property int startTime: parseInt(modelData.startTime)
property int endTime: parseInt(modelData.endTime) property int endTime: parseInt(modelData.endTime)
color: colorPalette.selected.calendarEvent color: colorPalette.selected.palette.surface0
anchors.right: parent.right anchors.right: parent.right
anchors.left: parent.left anchors.left: parent.left
anchors.rightMargin: 2 anchors.rightMargin: 2
anchors.leftMargin: 2 anchors.leftMargin: 2
radius: 4 radius: 4
y: daysSurface.hourHeight * startTime y: daysSurface.hourHeight * startTime
height: (endTime - startTime) * daysSurface.hourHeight height: (endTime - startTime) * daysSurface.hourHeight - 4
Rectangle {
anchors.fill: parent
color: backend.getTagColor(modelData.tags[0])
opacity: 0.2
}
Rectangle { Rectangle {
color: backend.getTagColor(modelData.tags[0]) color: backend.getTagColor(modelData.tags[0])
@ -162,9 +168,12 @@ ColumnLayout {
anchors.margins: 8 anchors.margins: 8
anchors.leftMargin: 12 anchors.leftMargin: 12
AppText { AppText {
color: backend.getTagColor(modelData.tags[0])
Layout.fillWidth: true
Layout.fillHeight: true
text: name text: name
wrapMode: Text.Wrap
} }
Item { Layout.fillHeight: true }
} }
} }
} }