Can an Extension detect dark mode?

Well that only works for Video Overlays. (No onContext for panels last I checked)

The simplest solution is to not have your panel using a transparent background.