1

Trying to reset the color of a linked cell.

Looking at a cell without color, the color attribute is (None, None, None, None)

So I tried:

cell.color = (None, None, None, None)

and

cell.color = None

Both raise

TypeError: '<' not supported between instances of 'NoneType' and 'int'

Is reseting the color supported by pysheets?

Jon
  • 13
  • 2
  • You are right, there is no way to reset from the api. we can only set colors. But isnt reset same as setting to white? – Nithin Jan 06 '21 at 21:46
  • @Nithin yes in most cases (we ended up doing that), but we have some automation which need to consider white and empty being the same now. No complaint from anyone people doing sheets in dark mode yet :) – Jon Jan 07 '21 at 01:45

2 Answers2

0

According to the Google Sheets API you need to pass a RGBA value, which means that you need to pass in values that are acceptable for the RGBA spectrum (0-255).

Try cell.color = (0,0,0,0), the fourth digit in the sequence specifies the alpha channel to be transparent.

Hopefully that helps.

  • 1
    Thanks for the comment, but (0,0,0,0) or (0,0,0,1) ends up as black. On the other end of the spectrum (1, 1, 1, 1 or 0) ends up as white. No reset through, might be a limit from Google APIs. – Jon Dec 21 '20 at 00:17
  • Thanks for the update @Jon, it was worth a try. – Dr. Mantis Tobbogan Dec 21 '20 at 14:12
0

To reset the color you can do :

cell.color = ()