8000 [Markdown] Specify theme context for images (Beta) · community · Discussion #16910 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Markdown] Specify theme context for images (Beta) #16910

Unanswered
dipree asked this question in General
May 19, 2022 · 13 comments · 27 replies
Discussion options

You can now specify the theme an image is displayed for in Markdown using the HTML <picture> element in combination with the prefers-color-scheme media feature.

For example:

<picture>
  <source media="(prefers-color-scheme: dark)" srcset="https://user-images.githubusercontent.com/25423296/163456776-7f95b81a-f1ed-45f7-b7ab-8fa810d529fa.png">
  <img alt="Shows an illustrated sun in light color mode and a moon with stars in dark color mode." src="https://user-images.githubusercontent.com/25423296/163456779-a8556205-d0a5-45e2-ac17-42d089e3c3f8.png">
</picture>

Renders as:

Shows an illustrated sun in light color mode and a moon with stars in dark color mode.

We released a first iteration of this functionality last year and received a lot of great feedback from you. We reviewed again the possibilities and concluded that using the HTML <picture> construct is the best option from multiple points of view. We came up with a solution that makes it work with the GitHub theming system which was the initial concern.

Thank you for all the great feedback so far and let us know if there's anything that isn't quite working as expected.

:octocat: 🐳

You must be logged in to vote

Replies: 13 comments 27 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
12 replies
@Gargron
Comment options

@bric3
Comment options

@BOTCAHX
Comment options

@daikon100
Comment options

@flynn31
Comment options

Comment options

You must be logged in to vote
5 replies
@lumaxis
Comment options

@vinkla
Comment options

@lumaxis
Comment options

@dipree
Comment options

@daikon100
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@Counselor8
Comment options

@daikon100
Comment options

@bric3
Comment options

@jhildenbiddle
Comment options

@bric3
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

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

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies

This comment was marked as off-topic.

@TaronVardanyan

This comment was marked as off-topic.

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
Markdown GitHub-flavored Markdown requests, issues, and more General General topics and discussions that don't fit into other categories, but are related to GitHub
0