Search code examples
google-api-clientgoogle-api-ruby-client

Google CalendarList API colors


I can't seem to get the color settings for adding a calendar to be subscribed to and visible to a user. I'm setting the values for foregroundColor and backgroundColor as well as setting the colorRgbFormat to true, but the color always comes up blue in the user's display, no matter what I set the colors to.

calendarList = api.calendar_list.insert.request_schema.new({
'id' => <calendar id>,
'hidden' => false,
'selected' => true,
'colorRgbFormat' => true,
'backgroundColor' => '#ffff00,
'foregroundColor' => '#000000'
})
result = client.execute(
  :api_method => api.calendar_list.insert,
  :body_object => calendarList
)

Solution

  • I'm getting good at answering my own questions today. colorRgbFormat is actually a parameter therefore the call should be:

    calendarList = api.calendar_list.insert.request_schema.new({
    'id' => cal_id,
    'hidden' => false,
    'selected' => true,
    'backgroundColor' => cal_color,
    'foregroundColor' => '#000000'
    })
    result = client.execute(
      :api_method => api.calendar_list.insert,
      :body_object => calendarList,
      :parameters => {'colorRgbFormat' => true,}
      )