Support SVG/CSS3 color names in calendar-color property



  • Hello,

    I’m using a CalDav calendar service which sends calendar colors in the iCal format (as far as I understand it from the DAVx5 debug log), which doesn’t seem to be supported by DAVx5.

    At first I thought that the server doesn’t send calendar color information at all, but then I noticed that the colors are read just fine by a desktop calendar client I’m using (KDE Kontact). So I started digging into this and found the following errors in the DAVx5 debug log:

    2020-01-26 12:39:54 1877 [at.bitfire.dav4jvm.Property] Ignoring unknown property http://apple.com/ns/ical/calendar-color
    2020-01-26 12:39:54 1877 [at.bitfire.dav4jvm.property.CalendarColor] Couldn't parse color, ignoring
    EXCEPTION java.lang.IllegalArgumentException: Couldn't parse color value: limegreen
    	at at.bitfire.dav4jvm.property.CalendarColor$Companion.parseARGBColor(CalendarColor.kt:43)
    	at at.bitfire.dav4jvm.property.CalendarColor$Factory.create(CalendarColor.kt:55)
    	at at.bitfire.dav4jvm.property.CalendarColor$Factory.create(CalendarColor.kt:48)
    	at at.bitfire.dav4jvm.PropertyRegistry.create(PropertyRegistry.kt:49)
    	at at.bitfire.dav4jvm.Property$Companion.parse(Property.kt:51)
    	at at.bitfire.dav4jvm.PropStat$Companion.parse(PropStat.kt:48)
    	at at.bitfire.dav4jvm.Response$Companion.parse(Response.kt:144)
    	at at.bitfire.dav4jvm.DavResource$processMultiStatus$2.invoke(DavResource.kt:465)
    	at at.bitfire.dav4jvm.DavResource.processMultiStatus(DavResource.kt:484)
    	at at.bitfire.dav4jvm.DavResource.processMultiStatus(DavResource.kt:435)
    	at at.bitfire.dav4jvm.DavResource.propfind(DavResource.kt:325)
    	at at.bitfire.davdroid.DavService.refreshCollections(DavService.kt:288)
    	at at.bitfire.davdroid.DavService.access$refreshCollections(DavService.kt:38)
    	at at.bitfire.davdroid.DavService$onStartCommand$$inlined$let$lambda$1.invoke(DavService.kt:75)
    	at at.bitfire.davdroid.DavService$onStartCommand$$inlined$let$lambda$1.invoke(DavService.kt:38)
    	at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)
    
    2020-01-26 12:39:54 1877 [at.bitfire.dav4jvm.Property] Ignoring unknown property http://apple.com/ns/ical/calendar-color
    

    The XML tag where this color information is contained is the following:

    <x1:calendar-color xmlns:x1="http://apple.com/ns/ical/">limegreen</x1:calendar-color>
    

    DAVx5 version: 2.6.3.1-gplay (329)
    Build date: 14 Jan 2020

    OS: Android 10 (00WW_4_10C)
    Device: Nokia 6.1

    If you need more debug information, let me know.

    Is there any chance that this will be supported in a future release of DAVx5?

    BTW. Your forum website doesn’t work in Firefox for some reason (latest version, no add-ons). It constantly displays an error message that the connection to bitfire was lost, or sth. like that.


  • developer

    Hi,

    Thanks for your report.

    @Tomasz-Kaźmierczak said in [Feature Request] Add support for iCal calendar colors:

    If you need more debug information, let me know.

    Yes: Which calendar service? Is there any way we can try ourselves? But it’s true, at the moment DAVx⁵ expects RGB(A) values.

    As far as I know, there is no specification of http://apple.com/ns/ical/:calendar-color. Do you know one? Do you have an idea why the server sends color names instead of an RGB(A) value?

    BTW. Your forum website doesn’t work in Firefox for some reason (latest version, no add-ons). It constantly displays an error message that the connection to bitfire was lost, or sth. like that.

    Must be something else, probably related to network connectivity. I’m only using Firefox myself.



  • So the provider is Runbox (https://runbox.com) - they provide email service along with calendar (CalDAV) and contacts (CardDAV).

    When I select a calendar color using their web interface, I can only choose from predefined set of colors, and after clicking on one, I can see the color’s name, the same one that is seen in the DAVx5 logs.

    The desktop calendar app that recognizes the color names is in fact Korganizer (Kontact is the name of the whole suite of apps). I took a brief look into its source code, obviously found nothing, but then thought it might be a good idea to checkout Qt framework and fond out (here: https://doc.qt.io/qt-5/qcolor.html) that the QColor class accepts SVG color names, so this must be why Korganizer displays them correctly.

    A quick search for SVG colors led me to this website:
    https://www.december.com/html/spec/colorsvg.html
    Compared a few color names against what’s available in the Runbox calendar and they seem to match.

    I guess an official SVG specification would be a better source, but the link provided in QColor class reference doesn’t seem to be correct.

    Hope this helps.

    And about Firefox - I’ve checked from another network and same thing, even tried disabling the browser’s privacy features. Well, I think I can live with using Chrome for just one website:)


  • developer

    Well the question for me is, is there a specification for calendar-color – anywhere where to find whether it shall contain (only) RGB(a) values or SVG names or HTML 3.2 color names, or whatever… I have never seen a specification yet, but it seems that Apple has “invented” it, and as far as I know, they only use RGB(A) values.

    Maybe it would be a good idea to ask Runbox and/or KDE people for whether they know a standard/specification?



  • The QColor documentation states clearly that Qt supports SVG 1.1 color names. There’s nothing about Apple or iCal there. Korganizer/Kontact just seems to be feeding the <calendar-color> contents into QColor. At least I haven’t found any special logic regarding <calendar-color> there.

    So the only real question is whether RunBox just uses SVG 1.1 color names on their calendar server, or anything else (iCal related). Since they provide a web interface for their calendar, and it’s there where you select the calendar colors, I took a look at the HTML/CSS for the color selection pop-up. They just use the color names straightforward in the HTML “style” attribute:

    style="color: limegreen;"
    

    So no - they do not use Apple-defined color names (if there is such a thing at all). If they did, they couldn’t just use them in the CSS “color” property in a web-browser exposed HTML (it’s not 1990’s any more). On the other hand, CSS “color” property allows using CSS1 color keywords and SVG color names. Since there are only 16 CSS1 color keywords, and Runbox allows selecting around 120 named colors, this means they use SVG color names.

    Given all the above, I would really gladly rename the feature request to “Add support for SVG color names in calendar colors”. Unfortunately, I cannot see such an option.


  • developer

    @Tomasz-Kaźmierczak Maybe there’s a misunderstanding. From a CalDAV perspective, it doesn’t matter whether a client uses Qt and which values are accepted by the Qt. Normally, every so-called “property” has a standardized description where you can find the allowed values. For instance, calendars have a calendar-description, so you can view https://tools.ietf.org/html/rfc4791#section-5.2.1 to see what values are allowed for calendar-description.

    Unfortunately, the standard RFC 4791 doesn’t define a property for calendar colors. So Apple has invented a custom property and called it calendar-color, without documenting it. At least I did not find any documentation; I’d by thankful if anyone could find one.

    Without documentation, I can only guess how calendar-color works; and I assume that Apple clients are “the only ones which set the standard for this property”, because Apple has invented and used this custom property. As far as I know, Apple only uses RGB(A) values for the calendar-color.

    So I wonder how KDE people came to the idea that they accept SVG colors for this property. I don’t say it’s wrong, because without standard, there is no wrong and right. I just wonder, and I think it could be better for compatibility if they do it like Apple. Interpreting SVG/CSS3 color names could still be implemented in DAVx⁵, but I’m interested in why they chose to use SVG/CSS3 color names as calendar-color instead of RGB(A) values like Apple and all other servers I have seen. Maybe the have more information about this mysterious, undocumented property 🙂



  • Thanks for changing the title for me.

    As for the Qt-CalDAV thing - I totally understand that CalDAV doesn’t have anything to do with Qt or the way it interprets color values. Qt also doesn’t have any idea about CalDAV. If you asked me, then I would say that this is just a total coincidence that Korganizer correctly displays calendar colors sent by the Runbox calendar service. The support for SVG color names was implemented in QColor for totally different reasons, not with Apple’s calendar-color in mind (Qt as a programming framework just supports SVG as one of many graphics formats, that’s why QColor needs to understand SVG color names). QColor, of course, supports also RGB(A) color values. And most probably Runbox chose to use SVG color names for their calendars because it was just more convenient for them (we give users 120 predefined SVG colors for their calendars - they be happy; we have less work - we be happy as well).

    Unfortunately, I also have no knowledge of the Apple’s calendar-color specification. From the DAVx5 logs I just assumed that these color names are Apple-defined and are part of their calendar-color specification. Turned out that my assumption was wrong. It seems that this caused a lot of unnecessary confusion 😀


Log in to reply
 

Similar topics

  • 3
  • 2
  • 13