How do you use the color definition modification for Google Calendar to allow custom colors for events?

I use the Google Calendar API to create new events. It seems the only way to assign an event color is with a color identifier (1 to 11) that looks at a specific color from the table.

The default 11 color palette is not perfect for my needs, so I would like to change it, but I could not figure out how to do it. The documentation explains how to get these lookup tables, but I can't figure out how to modify them. I assume that they can be changed because the structure has a timestamp the last time it was changed.

Does anyone know how to change the colorID table for events?

+8
api events colors google-calendar
source share
2 answers

I know that this thread is out of date, but the answer to this question is that you cannot edit the set colors of events. The new custom colors in the new API only correlate with the calendar color itself, and not with the events contained within.

Why does Google only make some of the colors customizable, and not everyone hits me. Until they realize the desire for more flowers, it would seem that we are stuck with a good ol '1-11.

+1
source share

Added detailed information from the bounty:

I have the same question. I would like to be able to set my own color for events that I send to the calendar, but do not want to be limited to 11 options. I see that in the docs they added an additional color adjustment method ( https://developers.google.com/google-apps/calendar/v3/whats-new#custom_colors_f or_calendars). But I do not understand how to do this.

This piece of documentation demonstrates these properties directly: https://developers.google.com/google-apps/calendar/v3/reference/calendarList/insert

This will allow you to add and change your personal calendar as a demo version (scroll down and try the API API). To do what you set here, set colorRgbFormat=true , then add the backgroundColor or foregroundColor properties with the specified color.

As a result, you will receive a request that looks like this:

 POST https://www.googleapis.com/calendar/v3/users/me/calendarList?colorRgbFormat=true&key={YOUR_API_KEY} Content-Type: application/json Authorization: Bearer xxxx X-JavaScript-User-Agent: Google APIs Explorer { "id": "SomeCalendarItem", "backgroundColor": "#444444" } 

Note: I think this answers the question of generosity, which is different from what the OP asked, but may be what the OP wanted - @Wescotte, please let me know if this solves (or does not) your problem.

+1
source share

All Articles