Skip to content

Fix for star-history.com chart images#15227

Open
joganubaid wants to merge 1 commit into
darkreader:mainfrom
joganubaid:star-history-fix
Open

Fix for star-history.com chart images#15227
joganubaid wants to merge 1 commit into
darkreader:mainfrom
joganubaid:star-history-fix

Conversation

@joganubaid
Copy link
Copy Markdown

Fix star-history.com embedded chart images in dark mode.

Star-history.com provides an API that generates SVG charts. When embedded on other sites (like GitHub README), these charts appear as light images on dark backgrounds, making them hard to read.

I was browsing trending GitHub repos at 2 AM (as every good developer does) and noticed star-history charts showing up as bright white blobs. After some investigation, I realized these charts come from api.star-history.com with a data-canonical-src attribute.

This fix:

  • Inverts images from api.star-history.com that don't already have theme=dark
  • Uses CSS :not() selector to avoid double-inversion for images that already use the dark theme parameter

For developers who somehow missed that theme=dark exists in the API (seriously, it's right there in the README) - your charts will now be readable in dark mode too.

Copilot AI review requested due to automatic review settings April 20, 2026 22:02
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Updates the global dynamic-theme fixes configuration to improve readability of embedded Star History SVG charts in dark mode by ensuring light-themed charts are inverted while avoiding double inversion for charts already requested in dark theme.

Changes:

  • Add an INVERT rule targeting img elements whose data-canonical-src points to api.star-history.com.
  • Exclude Star History images that already include theme=dark in data-canonical-src via :not(...).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@alexanderby
Copy link
Copy Markdown
Member

Could you please share an example? Is it worth having this fix for GitHub only, to avoid applying it for every website?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants