Change your Github Settings > Appearance > Theme (light to dark, or dark to light) and reload this page! You will note that none of these solutions work!
There are two broken ways I have tried this filter: invert(1) and display: none:
| Type | filter: invert(1) |
display: none |
|---|---|---|
| Markdown img tag [] | ||
| HTML img tag w/o width | ||
| HTML img tag w/ width |
Next I use markdown to generate the <table> and HTML for the <image> tags, which allows use of the HTML width property on the image tag. More importantly it allows the addition of a special anchor on the src URL that Github's markdown parser interprets to support dark mode. Even more importantly, the #gh-dark-mode-only and #gh-light-mode-only do not appear to work (at least for Gists, maybe they would in a project readme for "real" Github).
| Type | Light | Dark |
|---|---|---|
| Markdown img tag [] | ||
| Markdown img tag [] gh | ||
| Markdown img tag () | ||
| Markdown img tag () gh | ||
| Filter Green [] |

Crazy enough, these ALL work for me just fine.