Reputation: 55
I'm using Google Sheets v4 API and I want to use the color orange FF9900 which is available on Google Sheets UI, but RGBA in the API is not following the standard color RGBA. From this tool, I get rgba(236, 161, 51, 1) for the orange color.
Here is my request code using the Google APIs Explorer:
{
requests: [{
repeatCell: {
range:{
sheetId: correctsheetid,
startRowIndex: 2,
endRowIndex: 3,
},
cell:{
userEnteredFormat:{
backgroundColor: {
red: 236,
green: 161,
blue: 51
}
}
},
fields: 'userEnteredFormat(backgroundColor)'
}
}]
}
However, the output on the sheet is blue and not orange as intended.
Upvotes: 2
Views: 1707
Reputation: 261
Google use "0 to 1" scale for RGBA.
Use division by 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)'
}
}
]
}
Upvotes: 7