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

FeaturesQuick StartCardsThemesGitHub ActionCLIContributing


✨ 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

leetcode_profile_generator-1.0.0.tar.gz (60.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

leetcode_profile_generator-1.0.0-py3-none-any.whl (66.2 kB view details)

Uploaded Python 3

File details

Details for the file leetcode_profile_generator-1.0.0.tar.gz.

File metadata

File hashes

Hashes for leetcode_profile_generator-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5c0fb80fdc55e770a6be1fbf0d33401bece57dc30b59b173adbd2c307f2f52c1
MD5 599feaf602209b5eb99c0aa6ecc71ca4
BLAKE2b-256 a04649b23621432ad47b1bdf4f9385f9fac9b42ad03e68e8df5a78f15d451165

See more details on using hashes here.

Provenance

The following attestation bundles were made for leetcode_profile_generator-1.0.0.tar.gz:

Publisher: publish.yml on gufran21/LeetCodeProfileGenerator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file leetcode_profile_generator-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for leetcode_profile_generator-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c7a8e29e88590d6e6fac5f4f9dc1f3cfbdd742c3136d20fbff9a0e0394a8095
MD5 fe83beaa4de0b6e43d1fefd5448ad4d9
BLAKE2b-256 2c2007a7bbe4c00c35d91e63bfd0a12a751ea161c3d40262b4fc0353c0225679

See more details on using hashes here.

Provenance

The following attestation bundles were made for leetcode_profile_generator-1.0.0-py3-none-any.whl:

Publisher: publish.yml on gufran21/LeetCodeProfileGenerator

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page