A custom GitHub contribution snake animation built from scratch with TypeScript + SVG, then encoded to an animated GIF for profile embedding.
This project is intentionally independent from the original profile-repository snake and does not use Platane/snk.
GitHub GraphQL
↓
Contribution calendar
↓
Deterministic grid
↓
Custom snake path
↓
Growth + snake color cycle
↓
Animation timeline
↓
SVG frame renderer
↓
Animated GIF
↓
output/snake.gif
The snake grows by one segment when it consumes a non-empty contribution cell.
Each growth advances the snake through a fixed, deterministic color cycle:
- Initial state → blue
- 1st growth → soft pink
- 2nd growth → turquoise
- 3rd growth → yellow
- 4th growth → green
- 5th growth → blue
- Then the cycle repeats.
The contribution level still belongs to the consumed cell; it does not control the snake color.
Each consumed non-empty contribution cell emits a small heart in the new snake head's color. The heart floats upward, grows slightly, and fades out over a few frames without interrupting movement.
When the route ends, any remaining contribution hearts finish their animation before the finale begins. The snake then holds its final state, blinks three times in its final colors, disappears in three small light-colored puff bursts, and leaves the contribution grid and progress bar alone for a short empty-grid beat before the GIF loops. Hearts do not appear during the finale.
The background follows GitHub's dark visual style.
The generator rejects:
- empty animation timelines
- runaway frame counts above 500
- invalid GIF headers
- missing/empty artifacts
- GIFs larger than 1.5 MB
- unreasonable output dimensions
npm install
npm test
npm run buildTo generate against real GitHub data locally:
CONTRIBUTION_TOKEN=... npm run generateKeep the token in your shell environment or a secret manager. Never commit it.
The workflow supports manual dispatch, weekly regeneration and regeneration after changes land on main.
The contribution calendar is read with CONTRIBUTION_TOKEN. The workflow's built-in GITHUB_TOKEN is used only for publishing the generated artifact.
The generated public artifact is published to the output branch:
<img src="https://raw.githubusercontent.com/codelovingcat/github-snake-remix/output/snake.gif" alt="GitHub contribution snake" />Set the repository secret CONTRIBUTION_TOKEN before the first generation run.