How to pass a color table into object:setFillColor() ?

I would like to be able to do something like this : 

myColor = { 127/255, 50/255, 180/255 }

object:setFillColor(myColor)

For some reason this is not working. In the past we used to be able to pass in a table holding color values to any API call requiring color values. Not sure why setFillColor is not accepting this. setStrokeColor also seems to be affected by the same issue.

What am I missing? Or is this simply a bug?

Ok, as a workaround I realised I can use the following approach although this should not be required… It works but its ugly. 

myColor = { 127/255, 50/255, 180/255 }

object:setFillColor( myColor[1], myColor[2], myColor[3] )

object:setFillColor( unpack( myColor ) )

Hi Danny, 

Thanks for that. Will this inconsistency be fixed later on? Many other color assignment API calls accept tables directly. If not the solution you provide is also good. Appreciated. 

Regards,

Kerem

I think even more inconsistent than the array support is the new accepted range of colour parameters. Why do we as users of API need to divide colour codes by 255 before API accepts them? At least in my case this needs to happen always as I don’t get colours from Photoshop in 0…1 range.

Jyrki

Ok, as a workaround I realised I can use the following approach although this should not be required… It works but its ugly. 

myColor = { 127/255, 50/255, 180/255 }

object:setFillColor( myColor[1], myColor[2], myColor[3] )

object:setFillColor( unpack( myColor ) )

Hi Danny, 

Thanks for that. Will this inconsistency be fixed later on? Many other color assignment API calls accept tables directly. If not the solution you provide is also good. Appreciated. 

Regards,

Kerem

I think even more inconsistent than the array support is the new accepted range of colour parameters. Why do we as users of API need to divide colour codes by 255 before API accepts them? At least in my case this needs to happen always as I don’t get colours from Photoshop in 0…1 range.

Jyrki