Alternate Flash Icon between black/white on CameraPreview based on background color

Sorry if this is a silly question, I am quite new to Ionic Cordova and I haven’t been able to figure this one out yet.

We use this plugin for an app with a camera: https://github.com/cordova-plugin-camera-preview/cordova-plugin-camera-preview

We also have a Flash On/Off icon (2 images that alternate), but it’s white, so when the background is bright, it would be useful to change the icon to black (obviously by inserting a different image).

Thus, I assume I need to get the actual background brightness somehow whilst using the camera.

Any help would be appreciated.