I am trying to set the colour of a shape on google slides using AppsScript. I am able to achieve this but realise that transparency values are 0. How can I set a new colour and the transparency value? I have tried to add transparency direct to the hex i.e. #F2E4002B for 95% Transparency - but this fails.
function colourForeground(aShape) {
let aColour = "#E4002B"
aShape.getText().getTextStyle().setForegroundColor(aColour);
}
You can use setSolidFill(hexString,alpha) to set both the color and the opacity of the shape.
In the following example, we set hexString to
#E4002B
and alpha to 95% or0.95
:The second argument of this function (alpha) controls the opacity and takes values between
0
and1
.