SapuSeven / BetterUntis

An alternative mobile client for the Untis timetable system.
GNU General Public License v3.0
234 stars 33 forks source link

Support school colors for subjects #424

Open schmaller opened 10 months ago

schmaller commented 10 months ago

support school specific colors also for "subjects"

schmaller commented 10 months ago

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.

SapuSeven commented 10 months ago

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?

schmaller commented 10 months ago

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.