Skip to content
Discussion options

You must be logged in to vote

This behavior is not a bug in GitHub's Markdown parser, but rather the fundamental web standard design of HTML5 <picture> tags and browser media queries.

Here is why it happens and the official GitHub mechanism to make images follow GitHub's theme toggle:


Why <picture media=\"(prefers-color-scheme: ...)\"> Follows the OS

  1. The <picture> element and its media attribute are evaluated natively by the browser rendering engine, completely outside of GitHub's DOM and CSS classes.
  2. The browser's prefers-color-scheme CSS media query strictly inspects the host operating system's theme (via window.matchMedia).
  3. When you override GitHub's theme in your user settings (e.g. setting GitHub to "Dark" whil…

Replies: 4 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@kumarshreshtha
Comment options

Answer selected by kumarshreshtha
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug GitHub or a GitHub feature is not working as intended other General topics and discussions that don't fit into other categories, but are related to GitHub Welcome 🎉 Used to greet and highlight first-time discussion participants. Welcome to the community! source:ui Discussions created via Community GitHub templates Other Features and Feedback Discussions that fall into "Other" category
3 participants