How to get the color of the macOS menu bar?

My app icon is white in Dark mode and Black in normal mode. But as the menubar is transparent and takes on the color of the wallpaper, my icon is barely visible in dark mode if the wallpaper is light (this is the case with the default macOS wallpaper).
So I would have to determine if the wallpaper is black or dark (?). How to do ?
How do you deal with this?

You won’t.

You would use NSImage for the image with template = true mode, where you pass in a PDF with a vector graphics.
Then macOS would colorize it as needed.