Skip to content

fix: replace deprecated #gh-dark-mode-only fragments with <picture> element in Responsive Card Theme preview#4884

Open
Gilmoursa wants to merge 2 commits into
anuraghazra:masterfrom
Gilmoursa:fix/responsive-card-theme-broken-images
Open

fix: replace deprecated #gh-dark-mode-only fragments with <picture> element in Responsive Card Theme preview#4884
Gilmoursa wants to merge 2 commits into
anuraghazra:masterfrom
Gilmoursa:fix/responsive-card-theme-broken-images

Conversation

@Gilmoursa

@Gilmoursa Gilmoursa commented May 16, 2026

Copy link
Copy Markdown

What

Two locations in the README had broken images caused by the deprecated #gh-dark-mode-only / #gh-light-mode-only URL fragment syntax, which GitHub no longer renders:

  1. The preview at the top of the Responsive Card Theme section (had an additional malformed double anchor in the link href, e.g. #responsive-card-theme#gh-dark-mode-only)
  2. The live example inside the "Use GitHub's theme context tag" <details> block

Fix

Replaced both instances with <picture> elements using prefers-color-scheme media queries — the same approach the README itself documents as the correct modern method in the "Use GitHub's new media feature" subsection.

The catbox.moe screenshots in the Vercel setup guide were also audited and confirmed still live (all returning HTTP 200).

Testing

Verified locally that the <picture> syntax matches the working examples already present in the "Use GitHub's new media feature" subsection.

…lement in Responsive Card Theme preview

The two preview images at the top of the "Responsive Card Theme" section
used the old #gh-dark-mode-only / #gh-light-mode-only URL fragment syntax,
which GitHub no longer renders. They also had malformed double anchors in
their link hrefs (#responsive-card-theme#gh-dark-mode-only).

Replaced with the <picture> + prefers-color-scheme approach that the section
itself documents as the correct modern method.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented May 16, 2026

Copy link
Copy Markdown

@Gilmoursa is attempting to deploy a commit to the github readme stats Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation. label May 16, 2026
…cture> element

The live example in the 'Use GitHub's theme context tag' details block
used the deprecated #gh-dark-mode-only / #gh-light-mode-only URL fragment
syntax, which GitHub no longer renders, causing broken images.

Replaced with the <picture> + prefers-color-scheme approach, consistent
with the fix applied to the Responsive Card Theme section preview.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@martin-mfg

Copy link
Copy Markdown
Contributor

Thanks for the PR, but it seems the problem with the mentioned images is not the dark-mode/light-mode fragment. The problem is that the server is down and doesn't serve any images. We can see e.g. here that the dark-mode/light-mode fragments work.

Or did I miss something?

@Gilmoursa

Copy link
Copy Markdown
Author

Good catch on the server outage — you're right that the preview images are currently broken because of that, not purely the fragment syntax. That said, GitHub's documentation does explicitly mark #gh-dark-mode-only / #gh-light-mode-only as deprecated in favor of the <picture> element, so the fix is still valid as a proactive cleanup even if the images won't render until the server is back up. Happy to close if the project prefers to hold off until the deployment situation is resolved.

@martin-mfg

Copy link
Copy Markdown
Contributor

Good point. I agree that we should anyway recommend the <picture> approach.

I have created a PR in github-stats-extended. Because maintenance of this project has moved to https://github.com/stats-organization/github-stats-extended (see #3851 (comment) for context).

GitHub's documentation does explicitly mark #gh-dark-mode-only / #gh-light-mode-only as deprecated

Could you point me to this documentation please?

@Gilmoursa

Copy link
Copy Markdown
Author

Sorry for the overstatement. It's not explicitly deprecated. The sources I was using were third-party blog posts, not GitHub's docs. The approach is what GitHub recommends as the modern method, but it's not deprecated.https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/quickstart-for-writing-on-github#adding-an-image-to-suit-your-visitors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants