"Open image in a new tab" to the rescue! The extension I use (Dark Reader) didn't force dark mode for images, which means I can see the labels just fine in these cases.
It shouldn't be that hard for a dark mode implementation to determine which images are diagrams and which are photos, and switch the colors for one class of images and not the other.