Fast, lightweight GitHub contribution charts with light & dark theme support
Generate beautiful GitHub contribution charts as transparent SVG images with support for both light and dark themes, custom colors, and seamless integration into any website or documentation.
- π¨ Light & Dark Themes - Automatic theme adaptation for any background
- π Custom Colors - Any hex color or predefined themes
- β‘ Lightning Fast - Built with Go and optimized for performance
- π Transparent SVG - Perfect integration with any design
- π± Interactive Demo - Beautiful homepage with live theme switching
- π Simple API - Clean, RESTful endpoints
- βοΈ Zero Config - Works out of the box
<!-- Light theme (default) -->
<img src="https://ghchart.xqsit94.in/username" alt="GitHub Contributions">
<!-- Dark theme -->
<img src="https://ghchart.xqsit94.in/dark:default/username" alt="GitHub Contributions">
<!-- Custom colors -->
<img src="https://ghchart.xqsit94.in/light:ff5722/username" alt="GitHub Contributions">
<img src="https://ghchart.xqsit94.in/dark:6366f1/username" alt="GitHub Contributions">

GET /{username}
GET /{color}/{username}
GET /{username}?theme=light
GET /dark:default/{username}
GET /dark:{color}/{username}
GET /{username}?theme=dark
GET /{theme:color}/{username}
Where:
theme-lightordarkcolor- Hex color (without #) or special theme nameusername- GitHub username
| URL | Description |
|---|---|
/octocat |
Default light theme |
/dark:default/octocat |
Dark theme, default colors |
/light:ff5722/octocat |
Light theme, orange colors |
/dark:6366f1/octocat |
Dark theme, blue colors |
/halloween/octocat |
Light theme, halloween colors |
/dark:halloween/octocat |
Dark theme, halloween colors |
- Clone the repository:
git clone <repository-url>
cd ghchart- Install dependencies:
go mod tidy- Run the server:
go run .The server will start on port 8080 by default, or use the PORT environment variable.
- Create a Procfile:
web: ./ghchart
- Deploy:
git add .
git commit -m "Initial commit"
heroku create your-app-name
git push heroku mainFROM golang:1.21-alpine AS builder
WORKDIR /app
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN go build -o ghchart .
FROM alpine:latest
RUN apk --no-cache add ca-certificates
WORKDIR /root/
COPY --from=builder /app/ghchart .
EXPOSE 8080
CMD ["./ghchart"]| Variable | Default | Description |
|---|---|---|
PORT |
8080 |
Server port |
DOMAIN_PREFIX |
https://ghchart.xqsit94.in |
Domain prefix for frontend URLs |
- Copy the environment template:
cp .env.example .env- Edit
.envwith your local settings:
# For local development
DOMAIN_PREFIX=http://localhost:8080
PORT=8080| Theme | Light Mode | Dark Mode | Description |
|---|---|---|---|
default |
GitHub green | Bright green | Classic GitHub colors |
halloween |
Orange/yellow | Bright orange | Halloween theme |
teal |
Teal/aqua | Bright teal | Ocean theme |
Use any hex color (without the #):
ff5722- Orange6366f1- Blue8b5cf6- Purpleef4444- Red10b981- Emerald
# Light theme examples
/username # Default light
/ff5722/username # Orange light (legacy format)
/light:ff5722/username # Orange light (new format)
/halloween/username # Halloween light
# Dark theme examples
/dark:default/username # Default dark
/dark:ff5722/username # Orange dark
/dark:halloween/username # Halloween dark
# Query parameter format
/username?theme=light # Default light
/username?theme=dark # Default dark
/ff5722/username?theme=dark # Orange dark<!-- Adapts to system theme -->
<picture>
<source srcset="https://ghchart.xqsit94.in/dark:default/username"
media="(prefers-color-scheme: dark)">
<img src="https://ghchart.xqsit94.in/username" alt="GitHub Contributions">
</picture>/* Light mode styling */
.github-chart-light {
background: #ffffff;
border-radius: 8px;
padding: 16px;
}
/* Dark mode styling */
.github-chart-dark {
background: #0d1117;
border-radius: 8px;
padding: 16px;
}// Dynamic theme switching
function updateGitHubChart(username, isDark) {
const img = document.getElementById('github-chart');
const theme = isDark ? 'dark:default' : '';
const url = `https://ghchart.xqsit94.in/${theme}${theme ? '/' : ''}${username}`;
img.src = url;
}# Run with hot reload (if using air)
air
# Or run directly
go run ./cmd/server
# Run tests
go test ./...
# Format code
go fmt ./...
# Build for production
go build -o ghchart ./cmd/serverghchart/
βββ cmd/server/ # Application entry point
βββ internal/
β βββ chart/ # Chart generation logic
β β βββ colors.go # Theme and color management
β β βββ generator.go # SVG generation
β βββ handlers/ # HTTP handlers
β βββ services/ # GitHub API integration
βββ templates/ # HTML templates
βββ go.mod
All endpoints return SVG content with appropriate headers:
Content-Type: image/svg+xml
Cache-Control: public, max-age=86400
# Quick deploy
heroku create your-app-name
git push heroku main# Build image
docker build -t ghchart .
# Run container
docker run -p 8080:8080 ghchart| Variable | Default | Description |
|---|---|---|
PORT |
8080 |
Server port |
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details.