/**
* Dark mode for HTML email bodies rendered in a viewer iframe.
*
* Instead of inverting the whole body with a CSS filter (which turns brand
* red into pink, flips photos that then need re-inverting, and depends on
* which background attributes survived the external-content blocker), the
* rendered document is read back through getComputedStyle and its colours are
* rewritten in place:
*
* - Light backgrounds are darkened with their hue kept. Vivid colours (brand
* buttons, banners) and backgrounds that are already dark stay as sent.
* - Text and borders only change when they lack contrast against the new
* background; they are then lightened (or darkened) in their own hue.
* - Images are never touched. An element painted with a background image keeps
* its colours, and so does the text drawn straight on it: the sender
* designed the two to be read together.
*
* Because the pass works on computed styles, colours from inline styles,
* legacy attributes (bgcolor, ) and