Skip to main content

🏆 LeetCode Profile Generator

Generate beautiful SVG dashboards from your LeetCode profile for GitHub READMEs

MIT License Python 3.10+ GitHub Action

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

![LeetCode Stats](./assets/leetcode_stats.svg)
![Rating History](./assets/rating_history.svg)
![Heatmap](./assets/heatmap.svg)

📊 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:

![LeetCode Dashboard](./assets/dashboard.svg)
![LeetCode Stats](./assets/leetcode_stats.svg)
![Streak Card](./assets/streak.svg)

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

Metadata

Release files for leetcode-profile-generator 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for leetcode-profile-generator 1.0.0
File Size Uploaded
leetcode_profile_generator-1.0.0.tar.gz 60.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for leetcode-profile-generator 1.0.0
File Interpreter ABI Platform
leetcode_profile_generator-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 126.9 kB

Release files / leetcode_profile_generator-1.0.0.tar.gz

Download URL leetcode_profile_generator-1.0.0.tar.gz
Size 60.7 kB
Tags Source
SHA-256 checksum
How to use checksums
5c0fb80fdc55e770a6be1fbf0d33401bece57dc30b59b173adbd2c307f2f52c1
BLAKE2b-256 checksum
How to use checksums
a04649b23621432ad47b1bdf4f9385f9fac9b42ad03e68e8df5a78f15d451165
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release files / leetcode_profile_generator-1.0.0-py3-none-any.whl

Download URL leetcode_profile_generator-1.0.0-py3-none-any.whl
Size 66.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c7a8e29e88590d6e6fac5f4f9dc1f3cfbdd742c3136d20fbff9a0e0394a8095
BLAKE2b-256 checksum
How to use checksums
2c2007a7bbe4c00c35d91e63bfd0a12a751ea161c3d40262b4fc0353c0225679
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page