theoephraim / node-google-spreadsheet

Google Sheets API wrapper for Javascript / Typescript
https://theoephraim.github.io/node-google-spreadsheet
The Unlicense
2.34k stars 390 forks source link

[BUG] THE RGBA COLOR FORMAT IS GIVING WRONG COLORS #663

Closed iamrishan closed 1 year ago

iamrishan commented 1 year ago
var redColor = { red: 255, green: 0, blue: 0, alpha: 1 };

const cell1 = sheet1.getCell(1, 1);

cell1.backgroundColor = redColor;

await sheet1.saveUpdatedCells();

this should give the corresponding cell a red color instead of it a black color

image

DennisSnijder commented 1 year ago

@iamrishan you should provide RGBA colors between 0 and 1.

Try this: https://www.rapidtables.com/convert/color/hex-to-rgb.html

iamrishan commented 1 year ago

Oh, that's why... Thanks, i think it doesn't mention anywhere that the package uses RGB 0-1 values

iamrishan commented 1 year ago

https://rgbcolorpicker.com/0-1 this is cool if you wanna grab specific colors RGB 0-1 values

theoephraim commented 1 year ago

its definitely not obvious in google's docs. Would probably be good to clarify on the docs site and in the jsdoc type comments... Always open to PRs! otherwise will add in my next round of improvements...

Thanks