This project generates a Top Languages SVG card based on your commit history, not code size.
It queries the GitHub GraphQL API to fetch your repositories, counts commits per primary language, and produces a visual card you can embed in your README or website.
- Fetches your GitHub repositories via GraphQL API.
- Calculates language percentages based on commit count.
- Displays the top 7 languages plus an
"Others"category. - SVG output is styled with GitHub language colors.
- Lightweight Go HTTP server for serving the SVG dynamically.
-
Clone the repository:
git clone https://github.com/your-username/top-langs-commits.git cd top-langs-commits -
Install dependencies:
go mod tidy
-
Create a
colors.jsonfile containing GitHub language colors (from the linguist repository). -
Set up your GitHub personal access token (with
repoandread:userscopes):export GITHUB_TOKEN=your_token_here -
Run the server:
go run main.go
You can see it live without setting anything up!
Just use this URL:
https://better-readme-stats-ruberald8800-b77rzyn5.leapcell.dev/stats?username=YOUR_GITHUB_USERNAME
To embed in your own README, just add:
-
Percentages are commit-based:
percent = (commits for this language / total commits) * 100 -
Example: If you have 400 commits in Go and 100 in Python (total 500), Go = 80%, Python = 20%.
-
Top 7 languages shown, rest grouped into
"Others".
-
Percentages are size + repo count based:
ranking_index = (byte_count ^ size_weight) * (repo_count ^ count_weight) -
Favors languages with:
- Large total code size in your repos.
- More repositories using that language.
- This project → Measures how often you work with a language (activity).
- Readme Stats → Measures how much of your codebase is in that language (size & popularity).
- Go — server, API fetching, SVG templating
- GitHub GraphQL API — repository and commit data
- HTML Templates — SVG generation
- JSON — language color mapping
MIT License — feel free to modify and use in your own projects.
If you want, I can also add a **"How It Works"** diagram to visually show the API call → commit counting → SVG generation flow, which would make this README even more eye-catching.