I would like to invert an image when it only has a dark background or theme. For example, when I have a GUI window with a dark theme, I would like to invert its colors to make it light. However, when it has a light theme, just keep it as is.
I mean by dark theme not only black but also any other dark color (dark blue for example). I found some solutions that suggest counting zeros but I think this will work only for black backgrounds/themes.