How can an image be made, for insertion into a StackExchange question or answer, so that if a user uses dark mode and the web page's background is dark, the image displays as dark with white foreground; whereas if a user uses bright mode and the web page's background is bright, the image displays as bright with black foreground?
I know that, in a PNG file, the colour corresponding to some colour index can be made transparent. How to make it so would be a separate question relating to the app used to make the PNG file. But I see an issue in ensuring that the user's web browser displays the text in a colour contrasting with the background, whether the background is dark or bright.
I don't even know if this can be done -- it concerns how browsers render StackExchange web pages and the images they contain, rather than how to create the images. If it isn't possible, then there's no point in researching how to do the other steps in this work path, hence why I ask this question first.