Why do I need to pass color as name for setRangeFills?

If I use test for RGB color var name it doesn’t work, I must use color :

Hey, this is because you are using property shorthand.
See Object Literals Using Object Property Shorthand | JavaScript in Plain English

If you want to use test as variable pass instead.
[{ type: 'SOLID, color: test }]