From e7c97b0ffb628b4c0b8f180b1f73027aa2a1faf5 Mon Sep 17 00:00:00 2001 From: Daniel Adams Date: Tue, 24 May 2022 14:01:40 +0200 Subject: [PATCH] Update theme context docs (#27909) * Update theme context docs * Update example description * Update content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md * Update content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md * Update content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md Co-authored-by: hubwriter --- .../basic-writing-and-formatting-syntax.md | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md b/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md index 8abb87859562..aaecc97fdc45 100644 --- a/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md +++ b/content/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax.md @@ -148,14 +148,19 @@ For more information, see "[Relative Links](#relative-links)." {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5559 %} ### Specifying the theme an image is shown to -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. +You can specify the theme an image is displayed for in Markdown by using the HTML `` element in combination with the `prefers-color-scheme` media feature. 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. -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. +For example, the following code displays a sun image for light themes and a moon for dark themes: -| Context | URL | -|--------|--------| -| Dark Theme | `![GitHub Light](https://github.com/github-light.png#gh-dark-mode-only)` | -| Light Theme | `![GitHub Dark](https://github.com/github-dark.png#gh-light-mode-only)` | +```HTML + + + + Shows an illustrated sun in light color mode and a moon with stars in dark color mode. + +``` + +The old method of specifying images based on the theme, by using a fragment appended to the URL (`#gh-dark-mode-only` or `#gh-light-mode-only`), is deprecated and will be removed in favor of the new method described above. {% endif %} ## Lists