Transform your GitHub/GitLab contribution graph into an interactive Pac-Man game!
Original Project: abozanona/pacman-contribution-graph
Enhanced Edition: DuyetBKU - Added light/dark theme variants for all themes
- ๐ฎ Interactive Game: Play Pac-Man on your contribution calendar
- ๐จ 12 Color Themes: 6 theme families ร 2 variants (light + dark)
- GitHub, GitLab, Dracula, Solarized, Monokai, React
- ๐ Multi-Platform Support: GitHub, GitLab, and more platforms
- ๐ต Optional Sound Effects: Classic Pac-Man audio
- ๐ High Performance: Optimized canvas & SVG rendering
- ๐ฆ Easy Integration: NPM package, CLI tool, or GitHub Action
- โก Auto Light/Dark Mode: Detects your system preference
npm install pacman-contribution-graph<!DOCTYPE html>
<html>
<head>
<script src="node_modules/pacman-contribution-graph/dist/pacman-contribution-graph.min.js"></script>
</head>
<body>
<canvas id="pacman-canvas" width="1166" height="174"></canvas>
<script>
const renderer = new PacmanRenderer({
canvas: document.getElementById('pacman-canvas'),
platform: 'github',
username: 'your-username',
gameTheme: 'react-dark',
enableSounds: true
});
renderer.start();
</script>
</body>
</html>Without installing (recommended):
npx pacman-contribution-graph \
--platform github \
--username torvalds \
--gameTheme react-dark \
--output pacman.svgOr install globally:
npm install -g pacman-contribution-graph
pacman-contribution-graph \
--platform github \
--username torvalds \
--gameTheme react-dark \
--output pacman.svgUse this GitHub Action to automatically generate light + dark theme SVGs and display them in your README.
Fork to your GitHub account:
https://github.com/DuyetBKU/viz-pacman-github-profile
# Or clone and push to your own repo
git clone https://github.com/YOUR-USERNAME/viz-pacman-github-profile.git
cd viz-pacman-github-profile
git remote set-url origin https://github.com/YOUR-USERNAME/viz-pacman-github-profile.gitCreate the workflow file in your repository:
mkdir -p .github/workflowsThen create .github/workflows/pacman.yml:
name: generate pacman game
on:
schedule:
- cron: '0 */6 * * *' # Every 6 hours
workflow_dispatch: # Manual trigger
push:
branches:
- main
jobs:
generate:
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Create output branch if not exists
run: |
git fetch --all
git branch -r | grep origin/output || git checkout --orphan output && git push origin output
- name: Increase Node memory
run: echo "NODE_OPTIONS=--max-old-space-size=8192" >> $GITHUB_ENV
- name: Generate pacman graph (light & dark)
uses: DuyetBKU/viz-pacman-github-profile@main
with:
github_user_name: ${{ github.repository_owner }}
github_token: ${{ secrets.GITHUB_TOKEN }}
theme: react-dark
music: 'false'
- name: Push to output branch
uses: crazy-max/ghaction-github-pages@v3.1.0
with:
target_branch: output
build_dir: dist
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_TOKEN }}GitHub Actions needs a personal token to push SVG files to the output branch.
-
Create New Personal Access Token (classic):
- Token name:
PERSONAL_TOKEN - Select scopes:
- โ
repo(full control of private repositories) - โ
workflow(update GitHub Action workflows)
- โ
- Token name:
-
Copy the generated token (
โ ๏ธ Copy immediately, won't show again) -
Go to your repo: Settings โ Secrets and variables โ Actions
-
Click New repository secret:
- Name:
PERSONAL_TOKEN - Value: (paste your token)
- Name:
-
Click Add secret
This branch will store the generated SVG files separately from your main code.
# Option 1: Via command line
git checkout --orphan output
git commit --allow-empty -m "Initial output branch"
git push origin output
# Option 2: Via GitHub web interface
# Settings โ Branches โ New branch โ Type "output"- Go to Actions tab in your repo
- Select "generate pacman game" workflow
- Click "Run workflow" โ select main branch โ "Run workflow"
- Wait 30 seconds for SVG generation to complete โ
Check if files were created:
- Light theme:
https://raw.githubusercontent.com/YOUR-USERNAME/viz-pacman-github-profile/output/dist/pacman-contribution-graph-light.svg - Dark theme:
https://raw.githubusercontent.com/YOUR-USERNAME/viz-pacman-github-profile/output/dist/pacman-contribution-graph-dark.svg
Replace YOUR-USERNAME with your actual GitHub username.
This will automatically show dark theme on dark mode, light theme on light mode:
<div align="center">
<h2>๐ My Contribution Activity</h2>
<picture>
<source
media="(prefers-color-scheme: dark)"
srcset="
https://raw.githubusercontent.com/YOUR-USERNAME/viz-pacman-github-profile/output/dist/pacman-contribution-graph-dark.svg
"
/>
<source
media="(prefers-color-scheme: light)"
srcset="
https://raw.githubusercontent.com/YOUR-USERNAME/viz-pacman-github-profile/output/dist/pacman-contribution-graph-light.svg
"
/>
<img
alt="Pacman Contribution Graph"
src="https://raw.githubusercontent.com/YOUR-USERNAME/viz-pacman-github-profile/output/dist/pacman-contribution-graph-light.svg"
/>
</picture>
</div><div align="center">
<h3>Light Theme</h3>
<img
alt="Light"
src="https://raw.githubusercontent.com/YOUR-USERNAME/viz-pacman-github-profile/output/dist/pacman-contribution-graph-light.svg"
width="100%"
/>
<h3>Dark Theme</h3>
<img
alt="Dark"
src="https://raw.githubusercontent.com/YOUR-USERNAME/viz-pacman-github-profile/output/dist/pacman-contribution-graph-dark.svg"
width="100%"
/>
</div>| Theme ID | Style | Light | Dark |
|---|---|---|---|
| GitHub | GitHub colors | github-light |
github-dark |
| GitLab | GitLab colors | gitlab-light |
gitlab-dark |
| React | React cyan | react-light |
react-dark |
| Dracula | Dracula theme | dracula-light |
dracula-dark |
| Solarized | Solarized colors | solarized-light |
solarized-dark |
| Monokai | Monokai neon | monokai-light |
monokai-dark |
npx pacman-contribution-graph \
--platform github|gitlab \
--username YOUR_USERNAME \
--gameTheme github-light|github-dark|... \
--output output.svg \
--music true|falsenew PacmanRenderer({
// Required
canvas: HTMLCanvasElement,
platform: 'github' | 'gitlab',
username: string,
// Optional
gameTheme: string, // Default: 'github-light'
enableSounds: boolean, // Default: false
gameSpeed: number, // 0.5-2, Default: 1
outputFormat: 'canvas' | 'svg',
githubSettings: {
accessToken: string // For private contributions
}
});| Input | Action |
|---|---|
| โฌ๏ธ โฌ๏ธ โฌ ๏ธ โก๏ธ | Move Pac-Man |
| ๐ Eat dots | Score points |
| ๐ป Avoid ghosts | Don't get caught |
| โญ Eat ghosts | Score big when scared |
Solution: Ensure PERSONAL_TOKEN is set correctly in Secrets:
- Go to Settings โ Secrets and variables โ Actions
- Check that
PERSONAL_TOKENexists and is a valid GitHub token
Solution: Make sure you're using the correct SVG URL:
- Dark:
...pacman-contribution-graph-dark.svg - Light:
...pacman-contribution-graph-light.svg
Solution: Already handled in workflow with:
- name: Increase Node memory
run: echo "NODE_OPTIONS=--max-old-space-size=8192" >> $GITHUB_ENVIf still failing, increase further:
run: echo "NODE_OPTIONS=--max-old-space-size=16384" >> $GITHUB_ENVEdit .github/workflows/pacman.yml:
- name: Generate pacman graph (light & dark)
uses: DuyetBKU/viz-pacman-github-profile@main
with:
theme: react-dark # โ Change this to: github-light, gitlab-dark, dracula-light, etc.Then re-run the workflow.
git clone https://github.com/DuyetBKU/viz-pacman-github-profile.git
cd viz-pacman-github-profile
npm install
npm run buildsrc/
โโโ core/ # Game engine & theme definitions
โโโ movement/ # Ghost AI logic
โโโ providers/ # GitHub/GitLab API integration
โโโ renderers/ # Canvas & SVG rendering
โโโ utils/ # Helper functions
github-action/ # GitHub Action implementation
cli/ # CLI tool
dist/ # Compiled output (50KB minified)
- TypeScript - Type-safe development
- Webpack 5 - Module bundling
- Canvas/SVG - Graphics rendering
- GitHub API - Data source
| Metric | Value |
|---|---|
| Bundle Size | 50KB minified (~15KB gzip) |
| Canvas Performance | 60 FPS |
| SVG Performance | 5 FPS |
| Themes Available | 12 (6 ร light/dark) |
| Grid Size | 53 weeks ร 7 days |
- ๐ฆ NPM Package: https://www.npmjs.com/package/pacman-contribution-graph
- ๐ง GitHub Action: https://github.com/DuyetBKU/viz-pacman-github-profile
- ๐พ SVG Output: https://github.com/DuyetBKU/.github (output branch)
- ๐จ Color Themes: See constants in
src/core/constants.ts
MIT License - Feel free to use, modify, and distribute
- Original Creator: abozanona
- Enhanced by: DuyetBKU
- Inspired by: Retro gaming and the joy of open-source contributions
# Quick start with CLI
npx pacman-contribution-graph --platform github --username YOUR_USERNAME --output pacman.svg
# Or install globally
npm install -g pacman-contribution-graph
pacman-contribution-graph --username YOUR_USERNAMEDisplay in your README and watch your contributions turn into a fun game! ๐ฎ๐พ
Made with โค๏ธ and lots of ๐ป