An open API service indexing awesome lists of open source software.

https://github.com/iyehah/leetcode-status

Show your dynamically generated LeetCode stats on your GitHub profile or your website
https://github.com/iyehah/leetcode-status

card github graph leetcode status

Last synced: 1 day ago
JSON representation

Show your dynamically generated LeetCode stats on your GitHub profile or your website

Awesome Lists containing this project

README

        

# LeetCode Status

A Next.js application to display your LeetCode statistics as SVG cards or graphs, perfect for GitHub profiles or personal websites.

## How to Use

Add your LeetCode stats to your GitHub profile or site by using the following URL in your README, replacing `username` with your LeetCode username (e.g., `iyehah`):

```md
![Stats](https://leetcode-status.vercel.app/api/card/iyehah?theme=gradient&gradient_start=%236366F1&gradient_end=%23A855F7&logo=true&custom_title=Iyehah%20Hacen)
```

Or use an `` tag:

```md

```

## Available Themes

Choose from the following themes:

| Name | Card Preview | Graph Preview | Pie Preview |
|------|--------------|---------------|-------------|
| *light (Default)* | | | |
| *dark* | | | |
| *transparent* | | | |
| *neon* | | | |
| *pastel* | | | |
| *gradient* | |

## Customization

Customize the appearance using URL parameters.

### Common Options

| Argument | Description | Value Type |
|----------|-------------|------------|
| `border` | Show or hide the border | boolean (default: `true`) |
| `hide_title` | Show or hide the title | boolean (default: `false`) |
| `custom_title` | Set a custom title text | string |
| `logo` | Show or hide the LeetCode logo | boolean (default: `true`) |
| `logo_color` | Set logo color (`default`, `theme`, or hex like `%2300FF00`) | string (default: `default`) |
| `animation` | Enable or disable animation | boolean (default: `true`) |
| `animation_duration` | Set animation duration | homing string (default: `2s`) |
| `theme` | Set theme (`light`, `dark`, `transparent`, `neon`, `pastel`, `gradient`) | string (default: `light`) |
| `bar_color` | Custom color for progress bars (hex like `%23FF0000`) | string |
| `text_color` | Custom color for text (hex like `%230000FF`) | string |
| `show_stats` | Show additional stats (ranking, acceptance rate) | boolean (default: `false`) |
| `font` | Change font | boolean (default: `Robote`) |

### Card-Specific Options

| Argument | Description | Value Type |
|----------|-------------|------------|
| `gradient_start` | Gradient start color (hex like `%236366F1`) | string (default: `#6366F1` for gradient theme) |
| `gradient_end` | Gradient end color (hex like `%23A855F7`) | string (default: `#A855F7` for gradient theme) |

### Graph-Specific Options

| Argument | Description | Value Type |
|----------|-------------|------------|
| `bars_width` | Width of bars in the graph | number (20-100, default: `50`) |

### Pie-Specific Options

| Argument | Description | Value Type |
| ------------- | ------------------------------ | ------------------------- |
| `easyColor` | Color for Easy section (hex) | `%23FF0000` (e.g., red) |
| `mediumColor` | Color for Medium section (hex) | `%2300FF00` (e.g., green) |
| `hardColor` | Color for Hard section (hex) | `%230000FF` (e.g., blue) |
| `showLabels` | Show or hide percentage labels | boolean (default: `true`) |
| `showLegend` | Show or hide the legend | boolean (default: `true`) |
| `pieRadius` | Radius of the pie chart | number (default: `100`) |
| `font` | Font family used for text | string (e.g., `Arial`) |

### Examples

Card with gradient theme and custom gradient colors:

```md

```

Graph with neon theme and wider bars:

```md

```

Pie with transparent theme without Labels :

```md

```

> **Notes**:
> - Use `%20` for spaces in `custom_title` (e.g., `Iyehah%20Hacen`).
> - Use `%23` for `#` in hex colors (e.g., `%2300712D` for dark green).
> - The `show_stats` option requires the LeetCode API to provide `ranking` and `acceptanceRate`.

## Setup

1. **Install Dependencies**:
```bash
npm install
```
For `canvas`:
- Install MSYS2 and GTK2:
```bash
pacman -S mingw-w64-x86_64-gtk2
```
Add `C:\msys64\mingw64\bin` to `PATH`.
- Set GTK paths:
```bash
set PKG_CONFIG_PATH=C:\msys64\mingw64\lib\pkgconfig
set CAIRO_CFLAGS=-IC:\msys64\mingw64\include\cairo
set CAIRO_LIBS=-LC:\msys64\mingw64\lib -lcairo
npm install canvas --build-from-source
```

2. **Run Locally**:
```bash
npm run dev
```

3. **Deploy**:
Deploy to Vercel or another platform supporting Next.js.

## Contributing

Contributions are welcome! Please open an issue or pull request at [github.com/iyehah/leetcode-status](https://github.com/iyehah/leetcode-status).

## License

MIT