BetterUntis
BetterUntis copied to clipboard
Support school colors for subjects
support school specific colors also for "subjects"
I also restructured colorItems()
to reduce condition checks.
Inside the loop over items, it is sufficient to check once whether this particular element type should be overwritten with school colors.
I assume the method could by optimized even further.
Hey, thanks for your contribution.
I'm not sure however what you mean by "school specific colors also for subjects" - afaik there's a single school provided color for each timetable item and the preference lets you use it based on lesson state (i.e. only use school colors for regular lessons, override irregulars and tests with custom colors). How does your suggestion play into this?
Hi @SapuSeven , yes, every item can be individually colored. But at the school I'm connected to these items are colored all the same. Visual difference is only provided by the color of the subject of the lessons.
Timegrid items / lessons:
{
"id": 1000547,
"lessonId": 20840,
"startDateTime": "2023-11-06T11:25Z",
"endDateTime": "2023-11-06T12:10Z",
"foreColor": "#000000",
"backColor": "#f49f25",
"innerForeColor": "#000000",
"innerBackColor": "#000000",
"elements": [
{
"type": "SUBJECT",
"id": 31,
"orgId": 31
}]
},
{
"id": 1012382,
"lessonId": 20987,
"startDateTime": "2023-11-06T14:00Z",
"endDateTime": "2023-11-06T14:45Z",
"foreColor": "#000000",
"backColor": "#f49f25",
"innerForeColor": "#000000",
"innerBackColor": "#000000",
"elements": [
{
"type": "SUBJECT",
"id": 35,
"orgId": 35
}]
}
Subjects:
{
"id": 31,
"name": "Ek",
"longName": "Erdkunde",
"departmentIds": [],
"foreColor": "#000000",
"backColor": "#eb7ad4",
"active": true,
"displayAllowed": false
},
{
"id": 35,
"name": "Fu D",
"longName": "Förderunterricht D",
"departmentIds": [],
"foreColor": "#000000",
"backColor": "#ffbd7b",
"active": true,
"displayAllowed": false
},
Untis Mobile has such a setting as well
The result is this quite gaudy (but desired) timetable display.