How to fill color and opacity to rectangle annotation tool?

PDF.js Express Version

Detailed description of issue
Need to provide a green fill color with opacity 0.3 to the annotated part of pdf.

Expected behaviour

Link to document
{Provide a link to the document in question if possible}

Code snippet
{Provide a relevant code snippet}

Hey there!

You can apply a opacity directly to the annotation if you are creating it programmatically.

const annot = new Annotations.RectangleAnnotation();
annot.Opacity = 0.3;

You could also use the setStyles API to set the default color of rectangles. You can read a guide about it here.

If neither of these work for you, please let me know and provide some more details about how you’re actually creating the annotation.

Thanks!
Logan