Hello Shahid,
You can change the color of the rectangle tool programmatically like so:
documentViewer.addEventListener('documentLoaded', async () => {
setIsDocumentLoadedSuccessfully(true);
const rectangleTool = documentViewer.getTool('AnnotationCreateRectangle');
// Set default styles
rectangleTool.setStyles({
FillColor: new Annotations.Color(255, 0, 0),
StrokeColor: new Annotations.Color(0, 0, 0),
StrokeWidth: 2,
})
});
Best Regards,
Darian