And*_*dev 2 google-sheets google-sheets-api
我正在使用 Google Sheets v4 API,并且想使用 Google Sheets UI 上提供的橙色 FF9900,但 API 中的 RGBA 不遵循标准颜色 RGBA。从这个工具中,我得到橙色的 rgba(236, 161, 51, 1)。
这是我使用 Google API Explorer 的请求代码:
{
requests: [{
repeatCell: {
range:{
sheetId: correctsheetid,
startRowIndex: 2,
endRowIndex: 3,
},
cell:{
userEnteredFormat:{
backgroundColor: {
red: 236,
green: 161,
blue: 51
}
}
},
fields: 'userEnteredFormat(backgroundColor)'
}
}]
}
Run Code Online (Sandbox Code Playgroud)
但是,工作表上的输出是蓝色的,而不是预期的橙色。
小智 7
Google 对 RGBA 使用“0 到 1”比例。
使用除以 255
{
requests: [
{
repeatCell: {
range: {
sheetId: correctsheetid,
startRowIndex: 2,
endRowIndex: 3
},
cell: {
userEnteredFormat: {
backgroundColor: {
red: 236/255,
green: 161/255,
blue: 51/255
alpha: 0.5
}
}
},
fields: 'userEnteredFormat(backgroundColor)'
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1557 次 |
| 最近记录: |