Skip to content

Commit fe41d50

Browse files
authored
Add theme context for images in Markdown support (#22830)
* add theme context for images support
1 parent 5b8cb34 commit fe41d50

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

content/github/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,18 @@ Here are some examples for using relative links to display an image.
134134

135135
For more information, see "[Relative Links](#relative-links)."
136136

137+
{% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5559 %}
138+
### Specifying the theme an image is shown to
139+
140+
You can specify the theme an image is displayed to by appending `#gh-dark-mode-only` or `#gh-light-mode-only` to the end of an image URL, in Markdown.
141+
142+
We distinguish between light and dark color modes, so there are two options available. You can use these options to display images optimized for dark or light backgrounds. This is particularly helpful for transparent PNG images.
143+
144+
| Context | URL |
145+
|--------|--------|
146+
| Dark Theme | `![GitHub Light](https://github.com/github-light.png#gh-dark-mode-only)` |
147+
| Light Theme | `![GitHub Dark](https://github.com/github-dark.png#gh-light-mode-only)` |
148+
{% endif %}
137149

138150
## Lists
139151

0 commit comments

Comments
 (0)