google calender api setColorId

时间:2015-08-13 03:27:57

标签: google-calendar-api google-api-java-client

我想做一些事情event.setColorId("RED")来改变我的事件颜色 不幸的是,这是我得到的回应

{
  "code" : 400,
  "errors" : [ {
    "domain" : "global",
    "message" : "Invalid Value",
    "reason" : "invalid"
  } ],
  "message" : "Invalid Value"
}

有谁知道正确的方法?

由于

1 个答案:

答案 0 :(得分:0)

您应该将event.setColorId("11")设置为红色。

这些都是colorId的所有可能选项。

"1": {
   "background": "#ac725e",
   "foreground": "#1d1d1d"
  },
  "2": {
   "background": "#d06b64",
   "foreground": "#1d1d1d"
  },
  "3": {
   "background": "#f83a22",
   "foreground": "#1d1d1d"
  },
  "4": {
   "background": "#fa573c",
   "foreground": "#1d1d1d"
  },
  "5": {
   "background": "#ff7537",
   "foreground": "#1d1d1d"
  },
  "6": {
   "background": "#ffad46",
   "foreground": "#1d1d1d"
  },
  "7": {
   "background": "#42d692",
   "foreground": "#1d1d1d"
  },
  "8": {
   "background": "#16a765",
   "foreground": "#1d1d1d"
  },
  "9": {
   "background": "#7bd148",
   "foreground": "#1d1d1d"
  },
  "10": {
   "background": "#b3dc6c",
   "foreground": "#1d1d1d"
  },
  "11": {
   "background": "#fbe983",
   "foreground": "#1d1d1d"
  },
  "12": {
   "background": "#fad165",
   "foreground": "#1d1d1d"
  },
  "13": {
   "background": "#92e1c0",
   "foreground": "#1d1d1d"
  },
  "14": {
   "background": "#9fe1e7",
   "foreground": "#1d1d1d"
  },
  "15": {
   "background": "#9fc6e7",
   "foreground": "#1d1d1d"
  },
  "16": {
   "background": "#4986e7",
   "foreground": "#1d1d1d"
  },
  "17": {
   "background": "#9a9cff",
   "foreground": "#1d1d1d"
  },
  "18": {
   "background": "#b99aff",
   "foreground": "#1d1d1d"
  },
  "19": {
   "background": "#c2c2c2",
   "foreground": "#1d1d1d"
  },
  "20": {
   "background": "#cabdbf",
   "foreground": "#1d1d1d"
  },
  "21": {
   "background": "#cca6ac",
   "foreground": "#1d1d1d"
  },
  "22": {
   "background": "#f691b2",
   "foreground": "#1d1d1d"
  },
  "23": {
   "background": "#cd74e6",
   "foreground": "#1d1d1d"
  },
  "24": {
   "background": "#a47ae2",
   "foreground": "#1d1d1d"
  }
 },
 "event": {
  "1": {
   "background": "#a4bdfc",
   "foreground": "#1d1d1d"
  },
  "2": {
   "background": "#7ae7bf",
   "foreground": "#1d1d1d"
  },
  "3": {
   "background": "#dbadff",
   "foreground": "#1d1d1d"
  },
  "4": {
   "background": "#ff887c",
   "foreground": "#1d1d1d"
  },
  "5": {
   "background": "#fbd75b",
   "foreground": "#1d1d1d"
  },
  "6": {
   "background": "#ffb878",
   "foreground": "#1d1d1d"
  },
  "7": {
   "background": "#46d6db",
   "foreground": "#1d1d1d"
  },
  "8": {
   "background": "#e1e1e1",
   "foreground": "#1d1d1d"
  },
  "9": {
   "background": "#5484ed",
   "foreground": "#1d1d1d"
  },
  "10": {
   "background": "#51b749",
   "foreground": "#1d1d1d"
  },
  "11": {
   "background": "#dc2127",
   "foreground": "#1d1d1d"
  }