feat(growth): themes and alternative pages, result-screen hints

This commit is contained in:
shay
2026-11-28 10:22:36 -08:00
parent 3653ef66a5
commit c0eba0b5a4
6 changed files with 628 additions and 2 deletions
@@ -156,7 +156,8 @@
<p style="margin-top:24px"> <p style="margin-top:24px">
Want only one part? The Want only one part? The
<a href="https://gh-stats.com/github-top-languages-card.html">top languages card</a> <a href="https://gh-stats.com/github-top-languages-card.html">top languages card</a>
works the same way. Already using github-readme-stats? See the works the same way, and there are <a href="https://gh-stats.com/github-readme-themes.html">five
themes</a> to pick from. Already using github-readme-stats? See the
<a href="https://gh-stats.com/github-readme-stats-alternative.html">migration guide</a>. <a href="https://gh-stats.com/github-readme-stats-alternative.html">migration guide</a>.
</p> </p>
@@ -0,0 +1,177 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>github-profile-trophy not loading (402)? Two fixes</title>
<meta name="description"
content="github-profile-trophy.vercel.app returns HTTP 402, so trophy images in GitHub profile READMEs are broken. Self-host it, or swap in a rank card with one line."/>
<link rel="canonical" href="https://gh-stats.com/github-profile-trophy-alternative.html"/>
<link rel="icon" type="image/svg+xml" href="/favicon.svg"/>
<meta property="og:type" content="article"/>
<meta property="og:site_name" content="gh-stats"/>
<meta property="og:url" content="https://gh-stats.com/github-profile-trophy-alternative.html"/>
<meta property="og:title" content="github-profile-trophy not loading? Two fixes"/>
<meta property="og:description"
content="The public trophy instance returns 402. Self-host it, or use a rank card instead."/>
<meta property="og:image" content="https://gh-stats.com/og.png"/>
<meta name="twitter:card" content="summary_large_image"/>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400..700&family=Instrument+Serif&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"/>
<script type="module">
// Same GA4 stream as the SPA (index.html), so this page's traffic and its
// referrers land in the existing property instead of going unmeasured.
import {initializeApp} from "https://www.gstatic.com/firebasejs/12.13.0/firebase-app.js";
import {getAnalytics} from "https://www.gstatic.com/firebasejs/12.13.0/firebase-analytics.js";
getAnalytics(initializeApp({
apiKey: "AIzaSyCy2pUW8Geo0Aagq9mTYKlfCpa9GUIXpy8",
authDomain: "gh-stats-284de.firebaseapp.com",
projectId: "gh-stats-284de",
storageBucket: "gh-stats-284de.firebasestorage.app",
messagingSenderId: "723662839762",
appId: "1:723662839762:web:4ba5337f6489ea67dc320b",
measurementId: "G-228GR89RYX"
}));
</script>
<style>
:root{
--bg:#f9fafb; --card:#ffffff; --line:#e5e7eb;
--ink:#1f2937; --muted:#6b7280; --faint:#9ca3af; --accent:#0969da;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);
font-family:'DM Sans',system-ui,sans-serif;-webkit-font-smoothing:antialiased;
line-height:1.65}
main{max-width:760px;margin:0 auto;padding:56px 24px 96px}
h1{font-family:'Instrument Serif',Georgia,serif;font-weight:400;
font-size:2.6rem;line-height:1.15;letter-spacing:-.01em;margin:0 0 16px}
h2{font-family:'Instrument Serif',Georgia,serif;font-weight:400;
font-size:1.65rem;margin:48px 0 12px;letter-spacing:-.01em}
p{margin:0 0 16px}
.lede{font-size:1.08rem;color:var(--muted);margin-bottom:32px}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
code,pre{font-family:'JetBrains Mono',ui-monospace,monospace;font-size:.86rem}
pre{background:var(--card);border:1px solid var(--line);border-radius:10px;
padding:14px 16px;overflow-x:auto;margin:0 0 16px}
code:not(pre code){background:#f3f4f6;border-radius:5px;padding:.12em .38em;font-size:.85em}
.tablewrap{overflow-x:auto;margin:0 0 16px}
table{border-collapse:collapse;width:100%;font-size:.86rem;background:var(--card);
border:1px solid var(--line);border-radius:10px}
th,td{text-align:left;padding:10px 14px;border-bottom:1px solid var(--line);
vertical-align:top}
th{font-weight:600;color:var(--muted);font-size:.78rem;text-transform:uppercase;
letter-spacing:.04em}
tr:last-child td{border-bottom:none}
td code{white-space:nowrap}
figure{margin:0 0 28px}
figure img{width:100%;max-width:400px;display:block;border-radius:12px}
figcaption{color:var(--faint);font-size:.8rem;margin-top:8px}
.clip{position:relative;max-width:340px;max-height:400px;overflow:hidden;
border-radius:12px}
.clip img{width:100%;display:block;border-radius:12px}
.clip::after{content:"";position:absolute;left:0;right:0;bottom:0;height:72px;
background:linear-gradient(to top,var(--bg),transparent)}
.cta{display:inline-block;background:var(--ink);color:#fff;border-radius:9px;
padding:11px 20px;font-weight:600;font-size:.92rem;margin:8px 0 0}
.cta:hover{text-decoration:none;opacity:.9}
.note{border-left:3px solid var(--line);padding:2px 0 2px 16px;color:var(--muted);
font-size:.92rem;margin:0 0 16px}
footer{border-top:1px solid var(--line);margin-top:64px;padding-top:20px;
color:var(--faint);font-size:.82rem}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:20px;margin:0 0 16px}
.grid .clip{max-height:300px}
.grid h3{font-size:1rem;margin:0 0 8px}
.grid pre{font-size:.72rem;margin-top:10px}
@media (max-width:640px){h1{font-size:2.05rem}main{padding:36px 20px 72px}}
</style>
</head>
<body>
<main>
<h1>github-profile-trophy not loading?</h1>
<p class="lede">
The public instance at <code>github-profile-trophy.vercel.app</code> returns
<code>402 Payment required</code> (Vercel's <code>DEPLOYMENT_DISABLED</code>), so every
README that embeds it shows a broken image. There are two ways to fix it: run your own
copy, or switch to a different card.
</p>
<h2>Is yours broken?</h2>
<p>Open your profile. If the trophies are a broken-image icon or alt text, your README
points at the disabled instance. The line looks like this:</p>
<pre><code>[![trophy](https://github-profile-trophy.vercel.app/?username=YOUR_USERNAME)](https://github.com/ryo-ma/github-profile-trophy)</code></pre>
<h2>Fix 1: host your own copy</h2>
<p>
The project is open source and its README asks users to fork it and deploy the fork to
Vercel, then point the image at the new address. Its README also lists volunteer
mirrors, but most of them returned errors when this page was written (November 2026),
so a mirror may break again.
</p>
<h2>Fix 2: a rank card, in one line</h2>
<p>To switch to gh-stats instead, replace the line with this one, change the username, and commit:</p>
<pre><code>[![GitHub rank](https://gh-stats.com/api/YOUR_USERNAME/grade.svg)](https://gh-stats.com)</code></pre>
<figure>
<img src="https://gh-stats.com/api/torvalds/grade.svg" alt="gh-stats grade card: a letter rank, a score out of 100, and commit, PR, star, repo and follower counts." style="max-width:380px"/>
<figcaption>The grade card for torvalds, rendered live.</figcaption>
</figure>
<p>
There is no token to create, no signup and nothing to deploy. The first request for a
new username queues a build, so the image can take a minute to appear.
</p>
<h2>How it differs</h2>
<div class="tablewrap">
<table>
<tr><th></th><th>github-profile-trophy</th><th>gh-stats grade card</th></tr>
<tr><td>Shows</td><td>A row of trophies, each with its own rank</td><td>One overall rank and score, plus commits, PRs, stars, repos and followers</td></tr>
<tr><td>Extras</td><td>Many themes, row and column layout</td><td>Role tags worked out from your repos; five themes</td></tr>
<tr><td>Hosting</td><td>Public instance returns 402; self-host on Vercel</td><td>gh-stats.com, or self-host (MIT)</td></tr>
</table>
</div>
<h2>Want the whole profile?</h2>
<p>
Drop the <code>/grade.svg</code> and the same URL renders one card with the rank, a
contribution timeline, top collaborators, languages and streaks:
</p>
<pre><code>[![GitHub stats](https://gh-stats.com/api/YOUR_USERNAME)](https://gh-stats.com)</code></pre>
<a class="cta" href="https://gh-stats.com/">Preview it for your username</a>
<p style="margin-top:24px">
See the <a href="https://gh-stats.com/github-readme-themes.html">five themes</a>, or
<a href="https://gh-stats.com/github-profile-readme.html">how to create a profile README</a>
if you do not have one yet.
</p>
<h2>Common questions</h2>
<p>
<strong>Does gh-stats need access to my account?</strong> No. It reads public GitHub
activity only.
</p>
<footer>
<a href="https://gh-stats.com/">gh-stats.com</a> &middot;
<a href="https://github.com/ShayManor/github-readme-stats">source on GitHub</a> &middot;
MIT licensed
</footer>
</main>
</body>
</html>
@@ -0,0 +1,185 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>github-readme-activity-graph not loading (402)? Two fixes</title>
<meta name="description"
content="The vercel.app address of github-readme-activity-graph returns HTTP 402. Point at the project's new address, or swap in a different contribution graph with one line."/>
<link rel="canonical" href="https://gh-stats.com/github-readme-activity-graph-alternative.html"/>
<link rel="icon" type="image/svg+xml" href="/favicon.svg"/>
<meta property="og:type" content="article"/>
<meta property="og:site_name" content="gh-stats"/>
<meta property="og:url" content="https://gh-stats.com/github-readme-activity-graph-alternative.html"/>
<meta property="og:title" content="github-readme-activity-graph not loading? Two fixes"/>
<meta property="og:description"
content="The old vercel.app address returns 402. Here is the new one, and an alternative."/>
<meta property="og:image" content="https://gh-stats.com/og.png"/>
<meta name="twitter:card" content="summary_large_image"/>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400..700&family=Instrument+Serif&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"/>
<script type="module">
// Same GA4 stream as the SPA (index.html), so this page's traffic and its
// referrers land in the existing property instead of going unmeasured.
import {initializeApp} from "https://www.gstatic.com/firebasejs/12.13.0/firebase-app.js";
import {getAnalytics} from "https://www.gstatic.com/firebasejs/12.13.0/firebase-analytics.js";
getAnalytics(initializeApp({
apiKey: "AIzaSyCy2pUW8Geo0Aagq9mTYKlfCpa9GUIXpy8",
authDomain: "gh-stats-284de.firebaseapp.com",
projectId: "gh-stats-284de",
storageBucket: "gh-stats-284de.firebasestorage.app",
messagingSenderId: "723662839762",
appId: "1:723662839762:web:4ba5337f6489ea67dc320b",
measurementId: "G-228GR89RYX"
}));
</script>
<style>
:root{
--bg:#f9fafb; --card:#ffffff; --line:#e5e7eb;
--ink:#1f2937; --muted:#6b7280; --faint:#9ca3af; --accent:#0969da;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);
font-family:'DM Sans',system-ui,sans-serif;-webkit-font-smoothing:antialiased;
line-height:1.65}
main{max-width:760px;margin:0 auto;padding:56px 24px 96px}
h1{font-family:'Instrument Serif',Georgia,serif;font-weight:400;
font-size:2.6rem;line-height:1.15;letter-spacing:-.01em;margin:0 0 16px}
h2{font-family:'Instrument Serif',Georgia,serif;font-weight:400;
font-size:1.65rem;margin:48px 0 12px;letter-spacing:-.01em}
p{margin:0 0 16px}
.lede{font-size:1.08rem;color:var(--muted);margin-bottom:32px}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
code,pre{font-family:'JetBrains Mono',ui-monospace,monospace;font-size:.86rem}
pre{background:var(--card);border:1px solid var(--line);border-radius:10px;
padding:14px 16px;overflow-x:auto;margin:0 0 16px}
code:not(pre code){background:#f3f4f6;border-radius:5px;padding:.12em .38em;font-size:.85em}
.tablewrap{overflow-x:auto;margin:0 0 16px}
table{border-collapse:collapse;width:100%;font-size:.86rem;background:var(--card);
border:1px solid var(--line);border-radius:10px}
th,td{text-align:left;padding:10px 14px;border-bottom:1px solid var(--line);
vertical-align:top}
th{font-weight:600;color:var(--muted);font-size:.78rem;text-transform:uppercase;
letter-spacing:.04em}
tr:last-child td{border-bottom:none}
td code{white-space:nowrap}
figure{margin:0 0 28px}
figure img{width:100%;max-width:400px;display:block;border-radius:12px}
figcaption{color:var(--faint);font-size:.8rem;margin-top:8px}
.clip{position:relative;max-width:340px;max-height:400px;overflow:hidden;
border-radius:12px}
.clip img{width:100%;display:block;border-radius:12px}
.clip::after{content:"";position:absolute;left:0;right:0;bottom:0;height:72px;
background:linear-gradient(to top,var(--bg),transparent)}
.cta{display:inline-block;background:var(--ink);color:#fff;border-radius:9px;
padding:11px 20px;font-weight:600;font-size:.92rem;margin:8px 0 0}
.cta:hover{text-decoration:none;opacity:.9}
.note{border-left:3px solid var(--line);padding:2px 0 2px 16px;color:var(--muted);
font-size:.92rem;margin:0 0 16px}
footer{border-top:1px solid var(--line);margin-top:64px;padding-top:20px;
color:var(--faint);font-size:.82rem}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:20px;margin:0 0 16px}
.grid .clip{max-height:300px}
.grid h3{font-size:1rem;margin:0 0 8px}
.grid pre{font-size:.72rem;margin-top:10px}
@media (max-width:640px){h1{font-size:2.05rem}main{padding:36px 20px 72px}}
</style>
</head>
<body>
<main>
<h1>github-readme-activity-graph not loading?</h1>
<p class="lede">
The old github-readme-activity-graph address on vercel.app has returned
<code>402 Payment required</code> (Vercel's <code>DEPLOYMENT_DISABLED</code>) since
September 2026, so READMEs that still use it show a broken image. There are two ways
to fix it: point at the project's new address, or switch to a different graph.
</p>
<h2>Is yours broken?</h2>
<p>Open your profile. If the graph is a broken-image icon or alt text, your README points at
the disabled instance. The line looks like this:</p>
<pre><code>![Activity graph](https://github-readme-activity-graph.vercel.app/graph?username=YOUR_USERNAME)</code></pre>
<h2>Fix 1: the project's new address</h2>
<p>The project now runs on Cloudflare Workers. Change the domain and keep everything else:</p>
<pre><code>https://github-readme-activity-graph.ashutosh-dwivedi0710.workers.dev/graph?username=YOUR_USERNAME</code></pre>
<h2>Fix 2: a different graph, in one line</h2>
<p>To switch to gh-stats instead, replace the line with this one, change the username, and commit:</p>
<pre><code>[![Contribution graph](https://gh-stats.com/api/YOUR_USERNAME/impact.svg)](https://gh-stats.com)</code></pre>
<figure>
<img src="https://gh-stats.com/api/torvalds/impact.svg" alt="gh-stats impact timeline: weekly contributions over the last six months." style="max-width:380px"/>
<figcaption>The impact timeline for torvalds, rendered live.</figcaption>
</figure>
<p>
There is no token to create and no signup. The first request for a new username queues
a build, so the image can take a minute to appear.
</p>
<h2>How it differs</h2>
<div class="tablewrap">
<table>
<tr><th></th><th>github-readme-activity-graph</th><th>gh-stats impact timeline</th></tr>
<tr><td>Window</td><td>Last 31 days by default (up to 90), one point per day</td><td>Last six months, one point per week</td></tr>
<tr><td>Counts</td><td>Daily contributions</td><td>Weekly totals from your contribution calendar</td></tr>
<tr><td>Themes</td><td>Many, plus custom colours and title</td><td>Five: <code>?theme=midnight</code>, <code>onyx</code>, <code>nord</code>, <code>clean</code>, <code>paper</code></td></tr>
<tr><td>Address</td><td>Moved from vercel.app to workers.dev</td><td>gh-stats.com</td></tr>
</table>
</div>
<p>
A weekly line over six months is smoother than a daily one. It shows the shape of your
year, and a quiet weekend does not read as a gap.
</p>
<h2>Want the whole profile?</h2>
<p>
Drop the <code>/impact.svg</code> and the same URL renders one card with a score out of
100, the timeline, top collaborators, languages and streaks:
</p>
<pre><code>[![GitHub stats](https://gh-stats.com/api/YOUR_USERNAME)](https://gh-stats.com)</code></pre>
<a class="cta" href="https://gh-stats.com/">Preview it for your username</a>
<p style="margin-top:24px">
See the <a href="https://gh-stats.com/github-readme-themes.html">five themes</a>, or
<a href="https://gh-stats.com/github-profile-readme.html">how to create a profile README</a>
if you do not have one yet.
</p>
<h2>Common questions</h2>
<p>
<strong>Can I keep using github-readme-activity-graph?</strong> Yes. Use Fix 1; the
project is maintained and only its old vercel.app address is disabled.
</p>
<p>
<strong>Does gh-stats need access to my account?</strong> No. It reads public GitHub
activity only.
</p>
<footer>
<a href="https://gh-stats.com/">gh-stats.com</a> &middot;
<a href="https://github.com/ShayManor/github-readme-stats">source on GitHub</a> &middot;
MIT licensed
</footer>
</main>
</body>
</html>
@@ -0,0 +1,193 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>GitHub README stats card themes: dark, light and auto-switching</title>
<meta name="description"
content="Five themes for a GitHub profile stats card, with a live preview and a copy-paste line for each, plus the snippet that switches between dark and light with the viewer's GitHub theme."/>
<link rel="canonical" href="https://gh-stats.com/github-readme-themes.html"/>
<link rel="icon" type="image/svg+xml" href="/favicon.svg"/>
<meta property="og:type" content="article"/>
<meta property="og:site_name" content="gh-stats"/>
<meta property="og:url" content="https://gh-stats.com/github-readme-themes.html"/>
<meta property="og:title" content="GitHub README stats card themes"/>
<meta property="og:description"
content="Five themes, a live preview of each, and dark/light auto-switching in one snippet."/>
<meta property="og:image" content="https://gh-stats.com/og.png"/>
<meta name="twitter:card" content="summary_large_image"/>
<link rel="preconnect" href="https://fonts.googleapis.com"/>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin/>
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,400..700&family=Instrument+Serif&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet"/>
<script type="module">
// Same GA4 stream as the SPA (index.html), so this page's traffic and its
// referrers land in the existing property instead of going unmeasured.
import {initializeApp} from "https://www.gstatic.com/firebasejs/12.13.0/firebase-app.js";
import {getAnalytics} from "https://www.gstatic.com/firebasejs/12.13.0/firebase-analytics.js";
getAnalytics(initializeApp({
apiKey: "AIzaSyCy2pUW8Geo0Aagq9mTYKlfCpa9GUIXpy8",
authDomain: "gh-stats-284de.firebaseapp.com",
projectId: "gh-stats-284de",
storageBucket: "gh-stats-284de.firebasestorage.app",
messagingSenderId: "723662839762",
appId: "1:723662839762:web:4ba5337f6489ea67dc320b",
measurementId: "G-228GR89RYX"
}));
</script>
<style>
:root{
--bg:#f9fafb; --card:#ffffff; --line:#e5e7eb;
--ink:#1f2937; --muted:#6b7280; --faint:#9ca3af; --accent:#0969da;
}
*{box-sizing:border-box}
body{margin:0;background:var(--bg);color:var(--ink);
font-family:'DM Sans',system-ui,sans-serif;-webkit-font-smoothing:antialiased;
line-height:1.65}
main{max-width:760px;margin:0 auto;padding:56px 24px 96px}
h1{font-family:'Instrument Serif',Georgia,serif;font-weight:400;
font-size:2.6rem;line-height:1.15;letter-spacing:-.01em;margin:0 0 16px}
h2{font-family:'Instrument Serif',Georgia,serif;font-weight:400;
font-size:1.65rem;margin:48px 0 12px;letter-spacing:-.01em}
p{margin:0 0 16px}
.lede{font-size:1.08rem;color:var(--muted);margin-bottom:32px}
a{color:var(--accent);text-decoration:none}
a:hover{text-decoration:underline}
code,pre{font-family:'JetBrains Mono',ui-monospace,monospace;font-size:.86rem}
pre{background:var(--card);border:1px solid var(--line);border-radius:10px;
padding:14px 16px;overflow-x:auto;margin:0 0 16px}
code:not(pre code){background:#f3f4f6;border-radius:5px;padding:.12em .38em;font-size:.85em}
.tablewrap{overflow-x:auto;margin:0 0 16px}
table{border-collapse:collapse;width:100%;font-size:.86rem;background:var(--card);
border:1px solid var(--line);border-radius:10px}
th,td{text-align:left;padding:10px 14px;border-bottom:1px solid var(--line);
vertical-align:top}
th{font-weight:600;color:var(--muted);font-size:.78rem;text-transform:uppercase;
letter-spacing:.04em}
tr:last-child td{border-bottom:none}
td code{white-space:nowrap}
figure{margin:0 0 28px}
figure img{width:100%;max-width:400px;display:block;border-radius:12px}
figcaption{color:var(--faint);font-size:.8rem;margin-top:8px}
.clip{position:relative;max-width:340px;max-height:400px;overflow:hidden;
border-radius:12px}
.clip img{width:100%;display:block;border-radius:12px}
.clip::after{content:"";position:absolute;left:0;right:0;bottom:0;height:72px;
background:linear-gradient(to top,var(--bg),transparent)}
.cta{display:inline-block;background:var(--ink);color:#fff;border-radius:9px;
padding:11px 20px;font-weight:600;font-size:.92rem;margin:8px 0 0}
.cta:hover{text-decoration:none;opacity:.9}
.note{border-left:3px solid var(--line);padding:2px 0 2px 16px;color:var(--muted);
font-size:.92rem;margin:0 0 16px}
footer{border-top:1px solid var(--line);margin-top:64px;padding-top:20px;
color:var(--faint);font-size:.82rem}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:20px;margin:0 0 16px}
.grid .clip{max-height:300px}
.grid h3{font-size:1rem;margin:0 0 8px}
.grid pre{font-size:.72rem;margin-top:10px}
@media (max-width:640px){h1{font-size:2.05rem}main{padding:36px 20px 72px}}
</style>
</head>
<body>
<main>
<h1>Stats card themes for your GitHub profile README</h1>
<p class="lede">
A gh-stats card takes one <code>theme</code> parameter. Pick one of five, or serve a dark
card to dark-mode visitors and a light one to everyone else.
</p>
<h2>The five themes</h2>
<div class="grid">
<div>
<h3>midnight</h3>
<div class="clip"><img loading="lazy" src="https://gh-stats.com/api/ShayManor?theme=midnight" alt="gh-stats card in the midnight theme"/></div>
<p style="margin:8px 0 0;color:var(--muted);font-size:.86rem">Dark slate. The default look.</p>
<pre><code>?theme=midnight</code></pre>
</div>
<div>
<h3>onyx</h3>
<div class="clip"><img loading="lazy" src="https://gh-stats.com/api/ShayManor?theme=onyx" alt="gh-stats card in the onyx theme"/></div>
<p style="margin:8px 0 0;color:var(--muted);font-size:.86rem">High-contrast neon on pure black.</p>
<pre><code>?theme=onyx</code></pre>
</div>
<div>
<h3>nord</h3>
<div class="clip"><img loading="lazy" src="https://gh-stats.com/api/ShayManor?theme=nord" alt="gh-stats card in the nord theme"/></div>
<p style="margin:8px 0 0;color:var(--muted);font-size:.86rem">Muted pastels on slate blue.</p>
<pre><code>?theme=nord</code></pre>
</div>
<div>
<h3>clean</h3>
<div class="clip"><img loading="lazy" src="https://gh-stats.com/api/ShayManor?theme=clean" alt="gh-stats card in the clean theme"/></div>
<p style="margin:8px 0 0;color:var(--muted);font-size:.86rem">White, for light-mode profiles.</p>
<pre><code>?theme=clean</code></pre>
</div>
<div>
<h3>paper</h3>
<div class="clip"><img loading="lazy" src="https://gh-stats.com/api/ShayManor?theme=paper" alt="gh-stats card in the paper theme"/></div>
<p style="margin:8px 0 0;color:var(--muted);font-size:.86rem">Warm off-white.</p>
<pre><code>?theme=paper</code></pre>
</div>
</div>
<h2>Use a theme</h2>
<p>Add <code>?theme=</code> to the card URL in your README, replace the username, and commit:</p>
<pre><code>[![GitHub stats](https://gh-stats.com/api/YOUR_USERNAME?theme=nord)](https://gh-stats.com)</code></pre>
<p>Leave the parameter out and the card uses midnight.</p>
<h2>Switch with the viewer's GitHub theme</h2>
<p>
GitHub renders <code>&lt;picture&gt;</code> in READMEs and honours
<code>prefers-color-scheme</code>, so each visitor sees the card that matches their
GitHub appearance setting:
</p>
<pre><code>&lt;a href="https://gh-stats.com"&gt;
&lt;picture&gt;
&lt;source media="(prefers-color-scheme: dark)"
srcset="https://gh-stats.com/api/YOUR_USERNAME?theme=onyx"/&gt;
&lt;source media="(prefers-color-scheme: light)"
srcset="https://gh-stats.com/api/YOUR_USERNAME?theme=clean"/&gt;
&lt;img alt="GitHub stats" src="https://gh-stats.com/api/YOUR_USERNAME?theme=clean"/&gt;
&lt;/picture&gt;
&lt;/a&gt;</code></pre>
<p>Any dark theme works in the first line and any light one in the second.</p>
<a class="cta" href="https://gh-stats.com/">Preview every theme with your username</a>
<p style="margin-top:24px">
New to profile READMEs? Start with
<a href="https://gh-stats.com/github-profile-readme.html">how to create one</a>.
Coming from github-readme-stats? See the
<a href="https://gh-stats.com/github-readme-stats-alternative.html">migration guide</a>.
</p>
<h2>Common questions</h2>
<p>
<strong>Can I make a theme the default without the parameter?</strong> Yes. Sign in on
<a href="https://gh-stats.com/">gh-stats.com</a> with the GitHub account the card belongs
to, pick the theme, and save. <code>/api/YOUR_USERNAME</code> then uses it.
</p>
<p>
<strong>Does changing the theme reset my card?</strong> No. The theme changes colours
only; the data is the same.
</p>
<footer>
<a href="https://gh-stats.com/">gh-stats.com</a> &middot;
<a href="https://github.com/ShayManor/github-readme-stats">source on GitHub</a> &middot;
MIT licensed
</footer>
</main>
</body>
</html>
+15
View File
@@ -20,4 +20,19 @@
<changefreq>monthly</changefreq> <changefreq>monthly</changefreq>
<priority>0.8</priority> <priority>0.8</priority>
</url> </url>
<url>
<loc>https://gh-stats.com/github-readme-themes.html</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://gh-stats.com/github-readme-activity-graph-alternative.html</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>https://gh-stats.com/github-profile-trophy-alternative.html</loc>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
</urlset> </urlset>
@@ -1,5 +1,16 @@
import DOMPurify from 'dompurify' import DOMPurify from 'dompurify'
import { useMemo, useState } from 'react' import { useEffect, useMemo, useState } from 'react'
// Stats cards people already have in their profile README. A visitor who has
// one needs "replace that line", not "paste this somewhere".
const OTHER_CARDS: [RegExp, string][] = [
[/github-readme-stats/i, 'github-readme-stats'],
[/streak-stats|readme-streak/i, 'GitHub Readme Streak Stats'],
[/github-stats-extended/i, 'github-stats-extended'],
[/github-profile-summary-cards/i, 'github-profile-summary-cards'],
[/github-profile-trophy/i, 'github-profile-trophy'],
[/github-readme-activity-graph/i, 'github-readme-activity-graph'],
]
function sanitizeSvg(raw: string): string { function sanitizeSvg(raw: string): string {
return DOMPurify.sanitize(raw, { return DOMPurify.sanitize(raw, {
@@ -40,6 +51,36 @@ export function ResultScreen({ username, generating, generatedSvg, generateError
const profileRepo = encodeURIComponent(username) const profileRepo = encodeURIComponent(username)
const editReadmeUrl = `https://github.com/${profileRepo}/${profileRepo}/edit/HEAD/README.md` const editReadmeUrl = `https://github.com/${profileRepo}/${profileRepo}/edit/HEAD/README.md`
const createRepoUrl = `https://github.com/new?name=${profileRepo}&description=${encodeURIComponent('My GitHub profile')}&visibility=public` const createRepoUrl = `https://github.com/new?name=${profileRepo}&description=${encodeURIComponent('My GitHub profile')}&visibility=public`
// raw.githubusercontent.com sends Access-Control-Allow-Origin: *, so the
// browser can read the profile README directly. Any failure leaves the
// generic hint in place.
const [found, setFound] = useState<{ repo: string; card: string } | null>(null)
const otherCard = found?.repo === profileRepo ? found.card : null
// No profile repo at all: GitHub's new-file page takes ?filename=&value=, so
// after creating the (empty) repo one click opens a README with the card in it.
const [noRepo, setNoRepo] = useState<string | null>(null)
const addReadmeUrl = `https://github.com/${profileRepo}/${profileRepo}/new/main?filename=README.md&value=${encodeURIComponent(embedSnippet + '\n')}`
useEffect(() => {
let live = true
fetch(`https://raw.githubusercontent.com/${profileRepo}/${profileRepo}/HEAD/README.md`)
.then(r => {
// A 404 here can also mean readme.md in another case, so only the
// API's 404 for the repo itself counts as "no repo".
if (r.status === 404) {
fetch(`https://api.github.com/repos/${profileRepo}/${profileRepo}`)
.then(a => { if (live && a.status === 404) setNoRepo(profileRepo) })
.catch(() => {})
}
return r.ok ? r.text() : ''
})
.then(text => {
if (!live || /gh-stats\.com/i.test(text)) return
const hit = OTHER_CARDS.find(([re]) => re.test(text))
if (hit) setFound({ repo: profileRepo, card: hit[1] })
})
.catch(() => {})
return () => { live = false }
}, [profileRepo])
const copy = async () => { const copy = async () => {
try { try {
@@ -160,6 +201,20 @@ export function ResultScreen({ username, generating, generatedSvg, generateError
{' \u00b7 '} {' \u00b7 '}
<a href={createRepoUrl} target="_blank" rel="noopener noreferrer" className="text-gray-700 underline hover:text-gray-900">Create the repo</a> <a href={createRepoUrl} target="_blank" rel="noopener noreferrer" className="text-gray-700 underline hover:text-gray-900">Create the repo</a>
</p> </p>
{noRepo === profileRepo && (
<p className="mt-2 text-xs text-gray-600">
{username} has no profile README yet. 1.{' '}
<a href={createRepoUrl} target="_blank" rel="noopener noreferrer" className="text-gray-800 underline hover:text-gray-900">Create the repo</a>
{' '}(leave "Add a README" unticked). 2.{' '}
<a href={addReadmeUrl} target="_blank" rel="noopener noreferrer" className="text-gray-800 underline hover:text-gray-900">Add a README with this card in it</a>
{' '}and commit.
</p>
)}
{otherCard && (
<p className="mt-2 text-xs text-gray-600">
This README already shows a {otherCard} card. Replace that line with the one above to swap it for this card.
</p>
)}
</div> </div>
</> </>
)} )}