🏆 LeetCode Profile Generator
Generate beautiful SVG dashboards from your LeetCode profile for GitHub READMEs
Features • Quick Start • Cards • Themes • GitHub Action • CLI • Contributing
✨ Features
- 🎨 8 beautiful SVG cards — stats, rating graph, heatmap, difficulty, contests, badges, streak, dashboard
- 🎭 9 built-in themes — GitHub Dark/Light, Dracula, Nord, Catppuccin, Tokyo Night, Gruvbox, One Dark
- 🎯 Pure SVG — no screenshots, no browser automation, no raster images
- ⚡ Fast — parallel API calls, <8 second cold start
- 🤖 GitHub Action ready — automatic daily updates with one YAML file
- 🔧 Highly customizable — custom themes via JSON, toggle any card on/off
- 🆓 Free & open source — MIT license, self-hostable, zero dependencies beyond Python
- 📦 Zero backend — CLI tool, no server required
🚀 Quick Start
Install
pip install leetcode-profile-generator
Generate
leetcode-profile --username YourUsername --theme github_dark --output ./assets
Embed in README



📊 Cards
Stats Card (leetcode_stats.svg)
The primary profile overview — avatar, rating, rank, acceptance rate, and difficulty progress bars.
Rating History (rating_history.svg)
Smooth Bézier curve showing contest rating progression with peak and latest highlights.
Difficulty Distribution (difficulty.svg)
Horizontal bars showing easy/medium/hard solving progress with beats percentages.
Submission Heatmap (heatmap.svg)
GitHub-style contribution heatmap showing daily submission activity over the past year.
Contest History (contest_history.svg)
Table of recent 10 contests with ratings, ranks, and color-coded delta changes.
Badges (badges.svg)
Grid of earned LeetCode badges with upcoming badge progress.
Streak (streak.svg)
Current and longest streaks with monthly activity bar chart.
Dashboard (dashboard.svg)
All-in-one combined master card assembling Stats, Difficulty breakdown, Contest rating history, Activity streak, and 52-week Submission heatmap.
🎨 Themes
| Theme | Name |
|---|---|
| 🌑 | github_dark (default) |
| ☀️ | github_light |
| 🧛 | dracula |
| ❄️ | nord |
| 🐱 | catppuccin_mocha |
| ☕ | catppuccin_latte |
| 🌃 | tokyo_night |
| 🎨 | gruvbox_dark |
| ⚛️ | one_dark |
Custom Themes
Create a JSON file with your color palette:
{
"name": "my_theme",
"bg_color": "#1a1a2e",
"title_color": "#e94560",
"text_color": "#eaeaea",
"easy_color": "#4ecca3",
"medium_color": "#ffd369",
"hard_color": "#e94560"
}
leetcode-profile --username YourUser --theme path/to/my_theme.json
See themes/custom_example.json for all available fields.
🤖 GitHub Action (Zero Setup Workflow)
Simply create .github/workflows/leetcode.yml in your profile repository:
name: LeetCode Stats
on:
schedule:
- cron: '0 0 * * *' # Daily at midnight
workflow_dispatch:
jobs:
leetcode:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: gufran21/LeetCodeProfileGenerator@v1
with:
username: 'cpcs' # 👈 Replace with your LeetCode username
theme: 'github_dark'
generate_dashboard: 'true' # 👈 Enable cards you want generated
generate_stats: 'true'
generate_streak: 'true'
Embed in your GitHub Profile README.md:



Action Inputs
| Input | Default | Description |
|---|---|---|
username |
required | Your LeetCode username |
theme |
github_dark |
Color theme (github_dark, dracula, nord, catppuccin_mocha, etc.) |
output_dir |
assets |
Directory where SVG files are saved |
auto_commit |
true |
Automatically commit and push updated SVGs back to repository |
commit_message |
chore: update LeetCode profile cards [skip ci] |
Git commit message |
generate_dashboard |
false |
Set to 'true' to generate dashboard.svg |
generate_stats |
false |
Set to 'true' to generate leetcode_stats.svg |
generate_rating |
false |
Set to 'true' to generate rating_history.svg |
generate_difficulty |
false |
Set to 'true' to generate difficulty.svg |
generate_heatmap |
false |
Set to 'true' to generate heatmap.svg |
generate_streak |
false |
Set to 'true' to generate streak.svg |
generate_contest_history |
false |
Set to 'true' to generate contest_history.svg |
generate_badges |
false |
Set to 'true' to generate badges.svg |
💻 CLI
Usage: leetcode-profile [OPTIONS]
Options:
-u, --username TEXT LeetCode username (required)
-t, --theme TEXT Theme name or path to custom JSON
-o, --output TEXT Output directory
--stats / --no-stats Generate stats card
--rating / --no-rating Generate rating history
--difficulty / --no-difficulty
--heatmap / --no-heatmap
--streak / --no-streak
--contest-history / --no-contest-history
--badges / --no-badges
--dashboard / --no-dashboard
--no-cache Skip filesystem cache
--cache-ttl INTEGER Cache TTL in seconds (default: 86400)
--no-avatar Skip avatar fetch
-v, --verbose Debug logging
--list-themes List available themes
--version Show version
--help Show help
Examples
# Generate all cards with Dracula theme
leetcode-profile -u <username> -t dracula -o ./assets
# Only stats and rating cards
leetcode-profile -u <username> --no-heatmap --no-streak --no-badges --no-contest-history
# Force fresh data (skip cache)
leetcode-profile -u <username> --no-cache
# List all available themes
leetcode-profile --list-themes
🏗️ Architecture
CLI / GitHub Action
│
GraphQL Client (httpx async)
│
┌───┼───┐
▼ ▼ ▼
APIs (parallel fetch)
│
Data Models (dataclasses)
│
Data Service (orchestrator)
│
Card Generators (8 cards)
│
SVG Renderer + Theme Engine
│
Generated SVG Assets
🧪 Testing
pytest tests/ -v
The test suite includes:
- Model validation tests
- GraphQL client tests (mocked HTTP)
- Data service parsing tests
- Theme engine tests (all 9 themes)
- Card generator tests (XML validation, size limits)
- 8 cards × 9 themes = 72 parametrized card tests
- Streak calculator tests
- Cache tests (TTL, corruption recovery)
- CLI tests
📜 License
MIT — see LICENSE
🤝 Contributing
See CONTRIBUTING.md for development setup, how to add themes/cards, and PR guidelines.
If this project helps you, give it a ⭐!
Made with ❤️ for the competitive programming community
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file leetcode_profile_generator-1.0.0.tar.gz.
File metadata
- Download URL: leetcode_profile_generator-1.0.0.tar.gz
- Upload date:
- Size: 60.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c0fb80fdc55e770a6be1fbf0d33401bece57dc30b59b173adbd2c307f2f52c1
|
|
| MD5 |
599feaf602209b5eb99c0aa6ecc71ca4
|
|
| BLAKE2b-256 |
a04649b23621432ad47b1bdf4f9385f9fac9b42ad03e68e8df5a78f15d451165
|
Provenance
The following attestation bundles were made for leetcode_profile_generator-1.0.0.tar.gz:
Publisher:
publish.yml on gufran21/LeetCodeProfileGenerator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leetcode_profile_generator-1.0.0.tar.gz -
Subject digest:
5c0fb80fdc55e770a6be1fbf0d33401bece57dc30b59b173adbd2c307f2f52c1 - Sigstore transparency entry: 2304471856
- Sigstore integration time:
-
Permalink:
gufran21/LeetCodeProfileGenerator@82d9fd9eed06ccac01a3651b39fb523d740cef3c -
Branch / Tag:
refs/tags/v0.3 - Owner: https://github.com/gufran21
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@82d9fd9eed06ccac01a3651b39fb523d740cef3c -
Trigger Event:
release
-
Statement type:
File details
Details for the file leetcode_profile_generator-1.0.0-py3-none-any.whl.
File metadata
- Download URL: leetcode_profile_generator-1.0.0-py3-none-any.whl
- Upload date:
- Size: 66.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c7a8e29e88590d6e6fac5f4f9dc1f3cfbdd742c3136d20fbff9a0e0394a8095
|
|
| MD5 |
fe83beaa4de0b6e43d1fefd5448ad4d9
|
|
| BLAKE2b-256 |
2c2007a7bbe4c00c35d91e63bfd0a12a751ea161c3d40262b4fc0353c0225679
|
Provenance
The following attestation bundles were made for leetcode_profile_generator-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on gufran21/LeetCodeProfileGenerator
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
leetcode_profile_generator-1.0.0-py3-none-any.whl -
Subject digest:
7c7a8e29e88590d6e6fac5f4f9dc1f3cfbdd742c3136d20fbff9a0e0394a8095 - Sigstore transparency entry: 2304471965
- Sigstore integration time:
-
Permalink:
gufran21/LeetCodeProfileGenerator@82d9fd9eed06ccac01a3651b39fb523d740cef3c -
Branch / Tag:
refs/tags/v0.3 - Owner: https://github.com/gufran21
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@82d9fd9eed06ccac01a3651b39fb523d740cef3c -
Trigger Event:
release
-
Statement type: