How do I apply alpha to color?

I am trying to apply an alpha for color, but I can’t figure out how do it. I want to do something like:

node.strokes = [{ type: 'SOLID', color: {r: 0, g: 0, b: 0, a:1} }]

But this gets an error: Error: in set_strokes: Expected “strokes.[0].color” to have type {r: number, g: number, b: number} but got additional property “a”.

Right now I’m using opacity, but this controls the layer opacity not the color’s alpha channel.

As you may have noticed in the Plugin API documentation, opacity instead of alpha channel is only used for SolidPaint.

Could you share the code where you change the opacity? You are most likely changing the opacity of the node and not the opacity property of the strokes object.

@tank666 Thank you for you help! This is what I should have done: node.strokes = [{ type: 'SOLID', color: chart.color, opacity: chart.opacity }];