Skip to content

Commit c130a32

Browse files
committed
feat: add customizable options for graph rendering including title, total contributions, and background visibility
1 parent f372f95 commit c130a32

5 files changed

Lines changed: 227 additions & 150 deletions

File tree

README.md

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,19 +67,26 @@ GET https://stats.pphat.top/languages?username=pphatdev&theme=default
6767
Returns an SVG activity graph for a user for a specific year or the last 365 days.
6868

6969
Required query params:
70-
- username
70+
- `username`
7171

7272
Optional query params:
73-
- theme
74-
- year (default: last 365 days)
75-
- bgColor
76-
- borderColor
77-
- textColor
78-
- titleColor
73+
- `theme` — see [Graph Themes](#graph-themes) below
74+
- `year` — 4-digit year (default: last 365 days)
75+
- `animate` — cell animation mode: `glow` (default) | `wave` | `pulse` | `none`
76+
- `show_title` — show/hide the username + year heading (`true` default, `false` centers remaining content)
77+
- `show_total_contribution` — show/hide the contributions subtitle (`true` default, `false` also shrinks SVG height to fit content)
78+
- `show_background` — show/hide the background gradient, stars, and grid lines (`true` default, `false` makes bg transparent and shrinks SVG width to fit only the cells with 10px margin)
79+
- `bgColor`
80+
- `borderColor`
81+
- `textColor`
82+
- `titleColor`
7983

8084
Example:
8185
```
8286
GET https://stats.pphat.top/graph?username=pphatdev&year=2024
87+
GET https://stats.pphat.top/graph?username=pphatdev&theme=aurora
88+
GET https://stats.pphat.top/graph?username=pphatdev&theme=matrix&animate=pulse
89+
GET https://stats.pphat.top/graph?username=pphatdev&theme=ocean&animate=wave
8390
```
8491

8592
## Usage in README
@@ -104,6 +111,11 @@ Activity graph:
104111
![Activity Graph](https://stats.pphat.top/graph?username=YOUR_USERNAME)
105112
```
106113

114+
Activity graph with theme and animation:
115+
```markdown
116+
![Activity Graph](https://stats.pphat.top/graph?username=YOUR_USERNAME&theme=aurora&animate=pulse)
117+
```
118+
107119
## Example Themes
108120

109121
Use the `theme` query param. A few previews:
@@ -125,6 +137,30 @@ Use the `theme` query param. A few previews:
125137

126138
Full theme list is in [src/utils/themes.ts](src/utils/themes.ts).
127139

140+
## Graph Themes
141+
142+
These themes are tuned for the `/graph` heatmap card — vivid `iconColor` cells against near-black backgrounds.
143+
144+
| Theme | Key | Preview |
145+
|---|---|---|
146+
| 🌌 Aurora | `aurora` | ![aurora](https://stats.pphat.top/graph?username=pphatdev&theme=aurora) |
147+
| 💚 Matrix | `matrix` | ![matrix](https://stats.pphat.top/graph?username=pphatdev&theme=matrix) |
148+
| 🔥 Inferno | `inferno` | ![inferno](https://stats.pphat.top/graph?username=pphatdev&theme=inferno) |
149+
| 🌊 Ocean | `ocean` | ![ocean](https://stats.pphat.top/graph?username=pphatdev&theme=ocean) |
150+
| 💜 Neon | `neon` | ![neon](https://stats.pphat.top/graph?username=pphatdev&theme=neon) |
151+
| ☀️ Solar | `solar` | ![solar](https://stats.pphat.top/graph?username=pphatdev&theme=solar) |
152+
| 🌠 Galaxy | `galaxy` | ![galaxy](https://stats.pphat.top/graph?username=pphatdev&theme=galaxy) |
153+
| 🐙 GitHub Dark | `github-dark` | ![github-dark](https://stats.pphat.top/graph?username=pphatdev&theme=github-dark) |
154+
155+
### Animate Modes
156+
157+
| Mode | Description |
158+
|---|---|
159+
| `glow` | Default — active cells pulse with a soft glow |
160+
| `wave` | Cells ripple in a wave pattern across columns |
161+
| `pulse` | ~16 random cells flash independently |
162+
| `none` | No animation — static render |
163+
128164
## Development
129165

130166
### Prerequisites

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"type": "module",
77
"scripts": {
88
"build": "tsc",
9-
"dev": "node --watch --no-warnings=ExperimentalWarning --loader ts-node/esm ./src/index.ts | tsc --watch ",
9+
"dev": "node --watch --no-warnings=ExperimentalWarning --loader ts-node/esm ./src/index.ts",
1010
"start": "node dist/index.js",
1111
"test": "jest"
1212
},

0 commit comments

Comments
 (0)