CalDav Event Coloring: existing alternatives?

2.9k views Asked by At

It appears CalDav Event coloring is not supported - all events of one same calendar have the same color - the calendar's master color!

I am looking for an alternative way to get colored events within a "master-calendar" without creating as many calendars on my server as I have colors.

My first idea: create different calendars with different colors. Two issues here 1. Can I set a calendar's color via CalDav?

  1. Is it possible to "embed" different calendars in one "master calendar", having one color for each sub-calendar?

The reason I'd like to achieve something similar is that I'd like to avoid creating several accounts for each one of the sub-calendar, which would, in turn, force the user to register calendars individually (ok, I could use auto-detection, but it makes things a bit more complex for syncing in my case-study).

Does anyone have a suggestion for this?

2

There are 2 answers

6
hnh On

There is no RFC'ed standard on how to do colors on either calendars or events.

The iOS and OSX calendar clients only support a single calendar color, they can't color individual events (unlike Outlook, which has that extra 'color categories' feature).

You can set the Apple colors of a calendar via WebDAV. It is a (currently undocumented) Apple specific extension, a property on the calendar collection. Sample:

<calendar-color xmlns="http://apple.com/ns/ical/">#2952A3</calendar-color>

Use a regular PROPPATCH to set the color on an existing calendar (or within MKCOL when creating a collection):

PROPPATCH /your/calendar/url/ HTTP/1.1
...

<propertyupdate xmlns="DAV:">
  <set>
    <prop>
      <calendar-color xmlns="http://apple.com/ns/ical/">#2952A3</calendar-color>
    </prop>
  </set>
</propertyupdate>

Unfortunately it is not possible to embed calendars in other calendars in CalDAV: "Collections contained in calendar collections MUST NOT contain calendar collections at any depth, i.e., "nesting" of calendar collections within other calendar collections at any depth is not allowed." RFC 4791

Worse, most clients do not even allow calendars within arbitrary DAV collection hierarchies (that is, they only look at the calendar-home as a flat list and do not traverse non-calendar subcollections).

Summary: There is no 'reasonable' way to support per event colors, primarily because the Apple clients simply do not have that feature.

P.S.: Other CalDAV clients may have that feature (e.g. BusyCal), and embed the color in an event via an iCalendar X property, or again using a custom DAV property.

1
Hilmar Demant On

There seems to be a newer RFC which specifies color on calendar and event level.

https://www.rfc-editor.org/rfc/rfc7986

  1. Modifications to Calendar Components

This section details changes to the syntax defined in iCalendar [RFC5545]. New elements are defined in subsequent sections.

calprops =/ *( ; ; The following are OPTIONAL, ; but MUST NOT occur more than once. ; uid / last-mod / url / refresh / source / color ; ; The following are OPTIONAL, ; and MAY occur more than once. ; name / description / categories / image ; )

eventprop =/ *( ; ; The following are OPTIONAL, ; but MUST NOT occur more than once. ; color / ; ; The following are OPTIONAL, ; and MAY occur more than once. ; conference / image ; )

...

5.9. COLOR Property

Description: This property specifies a color that clients MAY use when presenting the relevant data to a user. Typically, this would appear as the "background" color of events or tasks. The value is a case-insensitive color name taken from the CSS3 set of names, defined in Section 4.3 of [W3C.REC-css3-color-20110607].

But i was not able to make it work on event level with mac Calendar and iOS, though i would suspect that those clients come up with the RFC extension implementation earliest as the author is from Apple.

Also a litte sad that only CSS3 color names would be supported ;(