How To Change UI Text and Icon Colors Based On Screen Background Color?

I would like to change the colors of text and icons in the UI as the players change their view of the game world. UI elements tend to disappear when rendered over a similar background color. I would like to dynamically change the UI colors to improve readability.

Any thoughts on how to accomplish this?