Hi guys, for good statusbar support on catalina/bigsur you need to use a black image and isTemplate like @D0miH said.
Using colored icon is not a good thing in macOs, only if it is dynamic, like change during program execution...
The real problem when you try to "detect if menu bar is light or dark" occours in multiple displays. Each display can have a different theme, so you cannot just detect it in one and create a new version, because both displays will render the same version.
Post
Replies
Boosts
Views
Activity
After 3 years and 2 months...
So yesterday I decided to revisit this topic :).
Using fcntl and F_LOG2PHYS is possible to check if files are using same physical blocks or not.
So I made an utility using this idea and put it on github ( https://github.com/dyorgio/apfs-clone-checker ).
It is only the first release guys, but I hope that the community can improve it.
Hello, I made some improvements on @tresf code, it now uses screenDevice based on mouse position and always work, no matter what wallpaper is in use.
The trick was compare the top pixel with a pixel inside de apple icon.
public static boolean isDarkTaskbar() {
		try {
				BufferedImage pixel = new Robot(MouseInfo.getPointerInfo().getDevice()).createScreenCapture(new Rectangle(30, 0, 1, 10));
				return getLuminosity(new Color(pixel.getRGB(0, 0))) < getLuminosity(new Color(pixel.getRGB(0, 9)));
		} catch (AWTException e) {
				log.warn("Unable to detect dark taskbar: {}", e.getMessage());
		}
		return false;
}
private static float getLuminosity(Color color) {
		return (color.getRed() * 0.299f) + (color.getGreen() * 0.587f) + (color.getBlue() * 0.114f);
}
But macOs allow users to have diff wallpapers in each screen, so it will blink a lot on this cenario if you change it at runtime many times.