How can I set the text color base on the wallpaper?

I've noticed that Apple automatically adjusts the menu bar icon/text color to black or white based on the wallpaper.

How can I implement a similar feature for my floating menu? Currently, it can be difficult to read with a light-colored wallpaper sometime as I have the Shuffle Wallpaper on.