Complete guide for setting up GitCanvas locally and creating custom themes.
New themes, new cards and new elements to personalise your GitHub Readme's are always welcome!!!
- Python 3.8+
- Git
# Clone and install
git clone https://github.com/devanshi14malhotra/GitCanvas.git
cd GitCanvas
pip install -r requirements.txt
# Run the app
streamlit run app.pyApp opens at http://localhost:8501
Create .env file for higher API limits (5,000/hour vs 60/hour):
GITHUB_TOKEN=your_github_token_herethemes/- Theme definitions and custom renderersgenerators/- SVG card generators for different statsutils/- GitHub API client, caching, validationapp.py- Main Streamlit applicationapi/- FastAPI backend endpoints
THEMES = {
# ... existing themes ...
"YourThemeName": {
"bg_color": "#0d1117",
"border_color": "#30363d",
"title_color": "#58a6ff",
"text_color": "#c9d1d9",
"icon_color": "#8b949e",
"font_family": "Segoe UI, Ubuntu, Sans-Serif"
}
}For special visualizations (like Matrix rain or Gaming snake), create themes/yourtheme.py:
import svgwrite
def render(data, theme, width=600, height=200):
"""
Custom visualization for YourTheme.
Args:
data: Contains 'username' and 'contributions' list
theme: Theme colors from styles.py
width/height: SVG dimensions
Returns:
str: SVG string
"""
dwg = svgwrite.Drawing(size=(width, height))
# Background
dwg.add(dwg.rect(insert=(0, 0), size=(width, height),
fill=theme["bg_color"]))
# Get real contribution data
contributions = data.get("contributions", [])
username = data.get("username", "User")
# Your visualization logic
for day in contributions:
count = day.get("count", 0)
if count <= 0:
continue
# Draw based on contribution count
return dwg.tostring()def draw_contrib_card(data, theme_name="Default", ...):
# ... existing code ...
elif original_theme_name == "YourThemeName":
from themes import yourtheme
svg = yourtheme.render(data, theme)
return svgstreamlit run app.py
# Select your theme and test with real usernamesDO:
- Use real contribution data:
data.get("contributions", []) - Skip zero contributions:
if count <= 0: continue - Add docstrings and comments
- Test with real usernames (e.g., "torvalds")
- Use theme colors:
theme["bg_color"]
DON'T:
- Generate fake/random data
- Show activity where none exists
- Remove documentation
- Hardcode colors
- Fork repository and create feature branch
- Make focused changes (one feature per PR)
- Test with multiple GitHub usernames
- Write clear commit messages
- Submit PR with description
- Write clean, documented code
- Follow PEP 8 style
- Always use real GitHub data
- Handle edge cases gracefully
feat: add Ocean theme with fish visualization
fix: resolve API rate limiting issue
docs: update tutorial with examples
Happy Contributing! 🎨✨
If you create an awesome theme, we'd love to see it. Don't hesitate to submit a PR!