This is a feature offered directly by some PDF viewers (like adobe acrobat and Sumatra PDF). It can also be accomplished on Linux window managers by inverting colors on just one window.
On Mac, the "invert colors" accessibility feature is all or nothing across the whole UI. Usually my work around is to switch my emacs over to white background at night and then invert the whole screen to make Skim+Emacs dark. (It's not ideal because there are still other windows and UI elements that are wrong.)
This is not possible. Apple does not offer this option. Also Apple draws
the PDF, not our code. Moreover Apple says content should not be modified
in dark mode, only ui. And I agree.