AI ้ฉฑๅจ็ไปฃ็ ๆชๅพ็พๅไธ็คพไบคๅไบซๅผๆ
AI-Powered Code Screenshot Beautifier & Social Sharing Engine
SnapCode-AI ๆฏไธๆฌพไธไธบๅผๅ่ ๆ้ ็ AI ้ฉฑๅจไปฃ็ ๆชๅพ็พๅๅทฅๅ ท๏ผ่ฎฉไฝ ่ฝปๆพๅฐๆฏ็ฅ็ไปฃ็ ็ๆฎต่ฝฌๅไธบไปคไบบๆ่ณ็็ฒพ็พๅพ็๏ผไธ้ฎๅไบซๅฐๅๅคง็คพไบคๅนณๅฐใ
| ็็น | SnapCode-AI ็่งฃๅณๆนๆก |
|---|---|
| ๐ฉ ไปฃ็ ๆชๅพไธ้ใไธไธไธ | ๐จ 21 ๆฌพ็ฒพๅฟ่ฎพ่ฎก็ไธป้ข๏ผ่ฆ็ไธปๆต็ผ่พๅจ้ฃๆ ผ |
| ๐ซ ๆฏไธชๅนณๅฐๅฐบๅฏธ่ฆๆฑไธๅ | ๐ฑ 19 ไธช็คพไบคๅนณๅฐ้ข่ฎพ๏ผไธ้ฎ้้ ๆไฝณๅฐบๅฏธ |
| ๐ฐ ่ฏญๆณ้ซไบฎไธๅฎๆด | ๐ป ๆฏๆ 20+ ็ผ็จ่ฏญ่จ๏ผ็ฒพๅ็่ฒ |
| ๐ญ ๅฎ่ฃ ไพ่ตๅคชๅคๅคช้บป็ฆ | โก ้ถๆ ธๅฟไพ่ต๏ผ็บฏ Python ๆ ๅๅบๅฎ็ฐ |
| ๐ต ๅทฅๅ ทๅคชๅคๆไธไผ็จ | ๐ฑ๏ธ ไบคไบๅผ Web UI + ็ฎๆด CLI๏ผไธๆๅณ็จ |
ๆไปฃ็ ๅๆ่บๆฏๅ๏ผ่ฎฉๅไบซๆไธบไธ็งไบซๅใ
ไป็ปๅ ธๅฐๆฝฎๆต๏ผๆปๆไธๆฌพ้ๅไฝ ๏ผ
| ๅ็ฑป | ไธป้ข |
|---|---|
| ๐ ๆทฑ่ฒ็ณป | Catppuccin MochaใDraculaใTokyo NightใNordใMonokaiใGitHub DarkใOne Dark ProใGruvbox DarkใSolarized DarkใVS Code DarkใAtom One DarkใPalenight |
| โ๏ธ ๆต ่ฒ็ณป | GitHub LightใSolarized LightใOne LightใVS Code LightใAtom One Light |
| ๐ ็น่ฒ็ณป | Catppuccin LatteใGruvbox LightใSnazzyใAyu Dark |
ๅฎๆดๆฏๆไปฅไธ่ฏญ่จ็่ฏญๆณ้ซไบฎ๏ผ
Python ยท JavaScript ยท TypeScript ยท Go ยท Rust ยท Java ยท C ยท C++ ยท Ruby ยท PHP
Swift ยท Kotlin ยท HTML ยท CSS ยท JSON ยท SQL ยท Bash ยท Markdown ยท YAML ยท Dockerfile
ไธ้ฎ็ๆ้้ ๅๅนณๅฐๆไฝณๅฐบๅฏธ็ไปฃ็ ๆชๅพ๏ผ
| ๅนณๅฐ | ๅ็ฑป | ่ฏดๆ |
|---|---|---|
| ๐จ๐ณ ๅพฎไฟกๆๅๅ | ๅฝๅ ็คพไบค | 1080ร1080px๏ผๆๅๅๆไฝณๅฑ็คบ |
| ๐ ๅฐ็บขไนฆ | ๅฝๅ ็คพไบค | 1080ร1440px๏ผ3:4 ็ซ็ๅก็ |
| ๐บ B ็ซ | ๅฝๅ ็คพไบค | 1920ร1080px๏ผ16:9 ๆจช็ๅฐ้ข |
| ๐ต ๆ้ณ | ๅฝๅ ็คพไบค | 1080ร1920px๏ผ9:16 ็ซ็ |
| โ ็ฅไน | ๅฝๅ ็คพไบค | 1200ร675px๏ผ16:9 ๅพๆๅก็ |
| ๐ข ๅพฎๅ | ๅฝๅ ็คพไบค | 1080ร1080px๏ผๆญฃๆนๅฝข้ ๅพ |
| ๐ฆ X / Twitter | ๅฝ้ ็คพไบค | 1600ร900px๏ผTwitter ๆไฝณๆฏไพ |
| ๐ผ LinkedIn | ๅฝ้ ็คพไบค | 1200ร627px๏ผLinkedIn ๆ็ซ ้ ๅพ |
| ๐ธ Instagram | ๅฝ้ ็คพไบค | 1080ร1080px๏ผๆญฃๆนๅฝขๅธๅญ |
| ๐ Facebook | ๅฝ้ ็คพไบค | 1200ร630px๏ผFacebook ๅไบซๅพ |
| ๐ GitHub README | ๅผๅ่ | 1280ร640px๏ผREADME Banner |
| ๐ DEV.to | ๅผๅ่ | 1000ร420px๏ผๆ็ซ ๅฐ้ข |
| ๐ฅ YouTube | ่ง้ขๅนณๅฐ | 1280ร720px๏ผ่ง้ข็ผฉ็ฅๅพ |
| ๐ฐ Medium | ๅๅฎขๅนณๅฐ | 1200ร630px๏ผๆ็ซ ๅคดๅพ |
| ๐ Discord | ็คพๅบๅนณๅฐ | 1200ร675px๏ผDiscord ๅตๅ ฅ |
| ๐ฌ Telegram | ็คพๅบๅนณๅฐ | 1200ร675px๏ผๆถๆฏ้ข่ง |
| ๐ Reddit | ็คพๅบๅนณๅฐ | 1200ร628px๏ผๅธๅญ้ ๅพ |
| ๐ง Email | ้่ฎฏๅทฅๅ ท | 800ร400px๏ผ้ฎไปถ็ญพๅ |
| ๐ ้็จ | ้็จๅบๆฏ | 1200ร800px๏ผไธ่ฝๅฐบๅฏธ |
ๅ ็ฝฎ HTTP ๆๅกๅจ๏ผๆไพๅฎๆถ้ข่ง็ Web ็้ข๏ผ
# ๅฏๅจ Web UI๏ผ้ป่ฎค็ซฏๅฃ 8964
snapcode web
# ๆๅฎ่ชๅฎไน็ซฏๅฃ
snapcode web --port 8080ไธ่กๅฝไปค๏ผๆๅฎไธๅ๏ผ
# ๅบ็ก็จๆณ๏ผ็พๅไปฃ็ ๆชๅพ
snapcode screenshot -f code.py
# ๆๅฎไธป้ขๅๅนณๅฐ้ข่ฎพ
snapcode screenshot -f code.py --theme dracula --preset twitter-x
# ่ชๅฎไน็ชๅฃๆ ้ข
snapcode screenshot -f code.py --title "My Awesome Code"
# ๆพ็คบ่กๅท
snapcode screenshot -f code.py --line-numbers
# ้ซไบฎๆๅฎ่ก
snapcode screenshot -f code.py --highlight 5,10,15-20
# ้ๆฉ็ชๅฃๆ ทๅผ
snapcode screenshot -f code.py --window-style macos็บฏ Python ๆ ๅๅบๅฎ็ฐ๏ผๆ ้ๅฎ่ฃ ไปปไฝ็ฌฌไธๆนไพ่ต๏ผ
pip install snapcode-ai # ไป
ๆญคไธๆญฅ๏ผๅผ็ฎฑๅณ็จๆฏๆ macOSใWindowsใLinux ไธๅคงๆไฝ็ณป็ป็็ชๅฃๅค่ง๏ผ
snapcode screenshot -f code.py --window-style macos # macOS ้ฃๆ ผ
snapcode screenshot -f code.py --window-style windows # Windows ้ฃๆ ผ
snapcode screenshot -f code.py --window-style linux # Linux ้ฃๆ ผ- โ ่กๅทๆพ็คบ / ้่
- โ
ๆๅฎ่ก้ซไบฎ๏ผๆฏๆ่ๅด๏ผๅฆ
5,10,15-20๏ผ - โ ่ชๅฎไน็ชๅฃๆ ้ข
- โ HTML ่พๅบๆ ผๅผ
- โ ่ชๅฎไน่พๅบ่ทฏๅพ
- Python 3.8 ๆๆด้ซ็ๆฌ
- pip ๅ ็ฎก็ๅจ
ๆนๅผไธ๏ผ้่ฟ PyPI ๅฎ่ฃ ๏ผๆจ่๏ผ
pip install snapcode-aiๆนๅผไบ๏ผไปๆบ็ ๅฎ่ฃ
git clone https://github.com/gitstq/snapcode-ai.git
cd snapcode-ai
pip install -e .# 1. ๅฎ่ฃ
pip install snapcode-ai
# 2. ๅๅปบไธไธช็คบไพไปฃ็ ๆไปถ
echo 'print("Hello, SnapCode-AI! ๐")' > hello.py
# 3. ็ๆ็ฒพ็พๆชๅพ
snapcode screenshot -f hello.py --theme dracula --preset wechat
# 4. ๆฅ็็ๆ็ๆชๅพ
# ่พๅบๆไปถ้ป่ฎคไฟๅญๅจๅฝๅ็ฎๅฝ# ๅฏๅจไบคไบๅผ Web ็้ข
snapcode web --port 8964
# ๆๅผๆต่งๅจ่ฎฟ้ฎ
# http://localhost:8964ๆ ธๅฟๅฝไปค๏ผ็จไบ็ๆไปฃ็ ๆชๅพ๏ผ
snapcode screenshot -f <ๆไปถ่ทฏๅพ> [้้กน]ๅฎๆดๅๆฐๅ่กจ๏ผ
| ๅๆฐ | ็ผฉๅ | ่ฏดๆ | ้ป่ฎคๅผ |
|---|---|---|---|
--file |
-f |
ไปฃ็ ๆไปถ่ทฏๅพ๏ผๅฟ ๅกซ๏ผ | - |
--theme |
-t |
ไธป้ขๅ็งฐ | dracula |
--preset |
-p |
็คพไบคๅนณๅฐ้ข่ฎพ | wechat |
--output |
-o |
่พๅบๆไปถ่ทฏๅพ | ่ชๅจ็ๆ |
--title |
-T |
็ชๅฃๆ ้ข | ๆไปถๅ |
--line-numbers |
-n |
ๆพ็คบ่กๅท | True |
--highlight |
-H |
้ซไบฎ่ก๏ผๅฆ 5,10,15-20๏ผ |
- |
--window-style |
-w |
็ชๅฃๆ ทๅผ๏ผmacos/windows/linux๏ผ | macos |
--format |
-F |
่พๅบๆ ผๅผ๏ผpng/html๏ผ | png |
--padding |
-P |
ๅ ่พน่ทๅคงๅฐ | 40 |
ไฝฟ็จ็คบไพ๏ผ
# ็ๆ้้
X/Twitter ็ Dracula ไธป้ขๆชๅพ
snapcode screenshot -f main.py --theme dracula --preset twitter-x
# ็ๆๅฐ็บขไนฆ้ฃๆ ผ็ไปฃ็ ๅก็
snapcode screenshot -f app.ts --theme tokyo-night --preset xiaohongshu
# ็ๆ GitHub README Banner
snapcode screenshot -f config.json --theme github-dark --preset github-readme
# ้ซไบฎๅ
ณ้ฎไปฃ็ ่ก
snapcode screenshot -f server.go --theme nord --highlight 10-25,30
# ๅฏผๅบไธบ HTML ๆ ผๅผ
snapcode screenshot -f style.css --theme catppuccin-mocha --format htmlๅฏๅจไบคไบๅผ Web UI ๆๅกๅจ๏ผ
snapcode web [้้กน]| ๅๆฐ | ่ฏดๆ | ้ป่ฎคๅผ |
|---|---|---|
--port |
ๆๅก็ซฏๅฃ | 8964 |
--host |
็ปๅฎๅฐๅ | 127.0.0.1 |
ๆฅ็ๆๆๅฏ็จไธป้ข๏ผ
snapcode themes่พๅบ็คบไพ๏ผ
๐จ Available Themes:
๐ Dark: catppuccin-mocha, dracula, tokyo-night, nord, monokai, ...
โ๏ธ Light: github-light, solarized-light, one-light, ...
๐ Special: catppuccin-latte, gruvbox-light, snazzy, ...
ๆฅ็ๆๆๅฏ็จๅนณๅฐ้ข่ฎพ๏ผ
snapcode presets่พๅบ็คบไพ๏ผ
๐ฑ Available Presets:
๐จ๐ณ Domestic: wechat, xiaohongshu, bilibili, douyin, zhihu, weibo
๐ Global: twitter-x, linkedin, instagram, facebook
๐จโ๐ป Developer: github-readme, dev-to
๐ฅ Video: youtube
๐ฐ Blog: medium
๐ฌ Community: discord, telegram, reddit
๐ง Other: email, generic
ๆฅ็ๆๆๆฏๆ็็ผ็จ่ฏญ่จ๏ผ
snapcode languagesๆฅ็็ๆฌไฟกๆฏ๏ผ
snapcode versionSnapCode-AI ็่ฎพ่ฎก้ตๅพชไปฅไธๆ ธๅฟๅๅ๏ผ
-
้ถไพ่ตๅฒๅญฆ ๐ฆ
- ๆ ธๅฟๅ่ฝๅฎๅ จๅบไบ Python ๆ ๅๅบๅฎ็ฐ
- ๆ ้ๅฎ่ฃ ไปปไฝ็ฌฌไธๆนๅ ๏ผ้ไฝ็ฏๅข้ ็ฝฎๆๆฌ
- ๆๅๅฏๅจ้ๅบฆ๏ผๅๅฐๆฝๅจ็ๅฎๅ จ้ฃ้ฉ
-
ไธป้ขๅผๆ่งฃ่ฆ ๐จ
- ไธป้ขไธๆธฒๆๅผๆๅฎๅ จๅ็ฆป
- ้็จ JSON ้ ็ฝฎๅฎไนไธป้ข๏ผไพฟไบ็คพๅบ่ดก็ฎ
- ๆฏๆ็จๆท่ชๅฎไนไธป้ขๆฉๅฑ
-
้ข่ฎพ็ณป็ป็ตๆดป ๐ฑ
- ็คพไบคๅนณๅฐ้ข่ฎพ็ฌ็ซไบไธป้ข็ณป็ป
- ้ข่ฎพๅฎไนไบๅฐบๅฏธใๅ่งใ้ดๅฝฑ็ญๅธๅฑๅๆฐ
- ๆฐๅขๅนณๅฐๅช้ๆทปๅ ไธไธช้ ็ฝฎๆไปถ
-
ๅๆจกๅผไบคไบ ๐ฑ๏ธ
- CLI ๆจกๅผ๏ผ้ๅ่ชๅจๅ่ๆฌๅ CI/CD ้ๆ
- Web UI ๆจกๅผ๏ผ้ๅไบคไบๅผๆข็ดขๅๅฎๆถ้ข่ง
- ไธค็งๆจกๅผๅ ฑไบซๅไธๅฅๆ ธๅฟๆธฒๆๅผๆ
- 21 ๆฌพ็ฒพ็พไธป้ข
- 20+ ็ผ็จ่ฏญ่จ่ฏญๆณ้ซไบฎ
- 19 ไธช็คพไบคๅนณๅฐ้ข่ฎพ
- ไบคไบๅผ Web UI
- CLI ๅฝไปค่กๅทฅๅ ท
- ้ถๆ ธๅฟไพ่ต
- ๅค็ง็ชๅฃๆ ทๅผ
- ่กๅทๆพ็คบ/้่ใ่ก้ซไบฎ
- HTML ่พๅบๆ ผๅผ
- ่ชๅฎไนไธป้ข็ผ่พๅจ๏ผWeb UI ๅ ็ฝฎ๏ผ
- ๆน้ๆชๅพ็ๆๆจกๅผ
- ๆดๅค็ผ็จ่ฏญ่จๆฏๆ๏ผScalaใElixirใHaskell ็ญ๏ผ
- ๆธๅ่ๆฏไธ่ชๅฎไนๆฐดๅฐ
- AI ๆบ่ฝไธป้ขๆจ่๏ผๆ นๆฎไปฃ็ ๅ ๅฎน่ชๅจๅน้ ๆไฝณไธป้ข๏ผ
- VS Code / JetBrains ๆไปถ้ๆ
- API ๆๅกๆจกๅผ๏ผๆฏๆ่ฟ็จ่ฐ็จ๏ผ
- ๅข้ไธป้ขๅ ฑไบซไธๅไฝ
- ๅจ็บฟ SaaS ๆๅก
- ไปฃ็ ๅจ็ป GIF ๅฏผๅบ
- ๆทฑๅบฆ็ผ่พๅจ้ๆ๏ผCursorใWindsurf ็ญ๏ผ
- ็คพๅบไธป้ขๅธๅบ
# 1. ๅฎ่ฃ
ๆๅปบๅทฅๅ
ท
pip install build twine
# 2. ๆๅปบๅๅๅ
python -m build
# 3. ๆฃๆฅๅ
ๅ
ๅฎน
twine check dist/*
# 4. ไธไผ ๅฐ PyPI
twine upload dist/*FROM python:3.11-slim
WORKDIR /app
COPY . .
RUN pip install snapcode-ai
EXPOSE 8964
CMD ["snapcode", "web", "--port", "8964", "--host", "0.0.0.0"]ๆๅปบไธ่ฟ่ก๏ผ
# ๆๅปบ้ๅ
docker build -t snapcode-ai .
# ่ฟ่กๅฎนๅจ
docker run -p 8964:8964 snapcode-ai#!/bin/bash
# deploy.sh - SnapCode-AI ๅฟซ้้จ็ฝฒ่ๆฌ
echo "๐ ๆญฃๅจ้จ็ฝฒ SnapCode-AI..."
# ๅฎ่ฃ
pip install snapcode-ai
# ้ช่ฏๅฎ่ฃ
snapcode version
echo "โ
้จ็ฝฒๅฎๆ๏ผ"
echo "๐ก ่ฟ่ก 'snapcode web' ๅฏๅจ Web UI"
echo "๐ก ่ฟ่ก 'snapcode screenshot -f your_code.py' ็ๆๆชๅพ"snapcode-ai/
โโโ snapcode_ai/ # ๆ ธๅฟๅ
โ โโโ __init__.py
โ โโโ cli.py # CLI ๅ
ฅๅฃ
โ โโโ web.py # Web UI ๆๅกๅจ
โ โโโ renderer/ # ๆธฒๆๅผๆ
โ โ โโโ screenshot.py # ๆชๅพๆธฒๆ
โ โ โโโ html.py # HTML ๆธฒๆ
โ โโโ themes/ # ไธป้ขๅฎไน
โ โ โโโ dark/ # ๆทฑ่ฒไธป้ข
โ โ โโโ light/ # ๆต
่ฒไธป้ข
โ โโโ presets/ # ๅนณๅฐ้ข่ฎพ
โ โโโ languages/ # ่ฏญๆณ้ซไบฎๅฎไน
โ โโโ utils/ # ๅทฅๅ
ทๅฝๆฐ
โโโ tests/ # ๆต่ฏ
โโโ setup.py # ๅฎ่ฃ
้
็ฝฎ
โโโ pyproject.toml # ้กน็ฎ้
็ฝฎ
โโโ Dockerfile # Docker ้
็ฝฎ
โโโ README.md # ๆฌๆไปถ
ๆไปฌๆฌข่ฟๅนถๆ่ฐขๆฏไธไฝ่ดก็ฎ่ ๏ผๆ ่ฎบไฝ ๆฏไฟฎๅคไบไธไธช Bugใๆทปๅ ไบไธไธชๆฐไธป้ข๏ผ่ฟๆฏๆน่ฟไบๆๆกฃ๏ผๆฏไธไปฝ่ดก็ฎ้ฝ่ฎฉ SnapCode-AI ๅๅพๆดๅฅฝใ
1. Fork ๅนถๅ ้้กน็ฎ
git clone https://github.com/gitstq/snapcode-ai.git
cd snapcode-ai2. ๅๅปบๅ่ฝๅๆฏ
git checkout -b feature/your-feature-name3. ๅผๅไธๆต่ฏ
# ๅฎ่ฃ
ๅผๅไพ่ต
pip install -e ".[dev]"
# ่ฟ่กๆต่ฏ
python -m pytest tests/
# ไปฃ็ ๆ ผๅผๅ
python -m black snapcode_ai/4. ๆไบคไปฃ็
git add .
git commit -m "feat: ๆทปๅ ๆฐๅ่ฝๆ่ฟฐ"
git push origin feature/your-feature-name5. ๅ่ตท Pull Request
ๅจ GitHub ไธๅๅปบ Pull Request๏ผๆ่ฟฐไฝ ็ๆนๅจๅ ๅฎนใ
- ๅจ
snapcode_ai/themes/็ฎๅฝไธๅๅปบไธป้ข้ ็ฝฎๆไปถ - ๅฎไน่ๆฏ่ฒใๅๆฏ่ฒใ่ฏญๆณ้ซไบฎ่ฒ็ญๅๆฐ
- ๆไบค PR ๅนถ้ๅธฆไธป้ข้ข่งๆชๅพ
- ๅจ
snapcode_ai/presets/็ฎๅฝไธๅๅปบ้ข่ฎพ้ ็ฝฎๆไปถ - ๅฎไน็ฎๆ ๅฐบๅฏธใๅ่งใ้ดๅฝฑ็ญๅๆฐ
- ๆไบค PR ๅนถ่ฏดๆๅนณๅฐ้้ ็ป่
- ้ตๅพช Conventional Commits ๆไบค่ง่
- ไปฃ็ ้ฃๆ ผ้ตๅพช PEP 8
- ๆทปๅ ๅ ๅ็ๆณจ้ๅๆๆกฃ
- ็กฎไฟๆๆๆต่ฏ้่ฟ
ๆฌ้กน็ฎๅบไบ MIT License ๅผๆบใ
MIT License
Copyright (c) 2024 gitstq
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Made with โค๏ธ by gitstq
ๅฆๆไฝ ่งๅพ SnapCode-AI ๅฏนไฝ ๆๅธฎๅฉ๏ผ่ฏท็ป้กน็ฎไธไธช โญ Star๏ผ
โญ Star this repo if you find it helpful!
AI ้ฉ ๅ็็จๅผ็ขผๆชๅ็พๅ่็คพ็พคๅไบซๅผๆ
AI-Powered Code Screenshot Beautifier & Social Sharing Engine
SnapCode-AI ๆฏไธๆฌพๅฐ็บ้็ผ่ ๆ้ ็ AI ้ฉ ๅ็จๅผ็ขผๆชๅ็พๅๅทฅๅ ท๏ผ่ฎไฝ ่ผ้ฌๅฐๆฏ็ฅ็็จๅผ็ขผ็ๆฎต่ฝๅ็บไปคไบบ้ฉ่ฑ็็ฒพ็พๅ็๏ผไธ้ตๅไบซๅฐๅๅคง็คพ็พคๅนณๅฐใ
| ็้ป | SnapCode-AI ็่งฃๆฑบๆนๆก |
|---|---|
| ๐ฉ ็จๅผ็ขผๆชๅ้้ใไธๅฐๆฅญ | ๐จ 21 ๆฌพ็ฒพๅฟ่จญ่จ็ไธป้ก๏ผ่ฆ่ไธปๆต็ทจ่ผฏๅจ้ขจๆ ผ |
| ๐ซ ๆฏๅๅนณๅฐๅฐบๅฏธ่ฆๆฑไธๅ | ๐ฑ 19 ๅ็คพ็พคๅนณๅฐ้ ่จญ๏ผไธ้ต้ฉ้ ๆไฝณๅฐบๅฏธ |
| ๐ฐ ่ชๆณ้ซไบฎไธๅฎๆด | ๐ป ๆฏๆด 20+ ็จๅผ่ช่จ๏ผ็ฒพๆบ่่ฒ |
| ๐ญ ๅฎ่ฃไพ่ณดๅคชๅคๅคช้บป็ ฉ | โก ้ถๆ ธๅฟไพ่ณด๏ผ็ด Python ๆจๆบๅฝๅผๅบซๅฏฆไฝ |
| ๐ต ๅทฅๅ ทๅคช่ค้ไธๆ็จ | ๐ฑ๏ธ ไบๅๅผ Web UI + ็ฐกๆฝ CLI๏ผไธๆๅณ็จ |
ๆ็จๅผ็ขผ่ฎๆ่่กๅ๏ผ่ฎๅไบซๆ็บไธ็จฎไบซๅใ
ๅพ็ถๅ ธๅฐๆฝฎๆต๏ผ็ธฝๆไธๆฌพ้ฉๅไฝ ๏ผ
| ๅ้ก | ไธป้ก |
|---|---|
| ๐ ๆทฑ่ฒ็ณป | Catppuccin MochaใDraculaใTokyo NightใNordใMonokaiใGitHub DarkใOne Dark ProใGruvbox DarkใSolarized DarkใVS Code DarkใAtom One DarkใPalenight |
| โ๏ธ ๆทบ่ฒ็ณป | GitHub LightใSolarized LightใOne LightใVS Code LightใAtom One Light |
| ๐ ็น่ฒ็ณป | Catppuccin LatteใGruvbox LightใSnazzyใAyu Dark |
ๅฎๆดๆฏๆดไปฅไธ่ช่จ็่ชๆณ้ซไบฎ๏ผ
Python ยท JavaScript ยท TypeScript ยท Go ยท Rust ยท Java ยท C ยท C++ ยท Ruby ยท PHP
Swift ยท Kotlin ยท HTML ยท CSS ยท JSON ยท SQL ยท Bash ยท Markdown ยท YAML ยท Dockerfile
ไธ้ต็ๆ้ฉ้ ๅๅนณๅฐๆไฝณๅฐบๅฏธ็็จๅผ็ขผๆชๅ๏ผ
| ๅนณๅฐ | ๅ้ก | ่ชชๆ |
|---|---|---|
| ๐จ๐ณ ๅพฎไฟกๆๅๅ | ๅๅ ง็คพ็พค | 1080ร1080px๏ผๆๅๅๆไฝณๅฑ็คบ |
| ๐ ๅฐ็ด ๆธ | ๅๅ ง็คพ็พค | 1080ร1440px๏ผ3:4 ็ซช็ๅก็ |
| ๐บ B ็ซ | ๅๅ ง็คพ็พค | 1920ร1080px๏ผ16:9 ๆฉซ็ๅฐ้ข |
| ๐ต ๆ้ณ | ๅๅ ง็คพ็พค | 1080ร1920px๏ผ9:16 ็ซช็ |
| โ ็ฅไน | ๅๅ ง็คพ็พค | 1200ร675px๏ผ16:9 ๅๆๅก็ |
| ๐ข ๅพฎๅ | ๅๅ ง็คพ็พค | 1080ร1080px๏ผๆญฃๆนๅฝข้ ๅ |
| ๐ฆ X / Twitter | ๅ้็คพ็พค | 1600ร900px๏ผTwitter ๆไฝณๆฏไพ |
| ๐ผ LinkedIn | ๅ้็คพ็พค | 1200ร627px๏ผLinkedIn ๆ็ซ ้ ๅ |
| ๐ธ Instagram | ๅ้็คพ็พค | 1080ร1080px๏ผๆญฃๆนๅฝข่ฒผๆ |
| ๐ Facebook | ๅ้็คพ็พค | 1200ร630px๏ผFacebook ๅไบซๅ |
| ๐ GitHub README | ้็ผ่ | 1280ร640px๏ผREADME Banner |
| ๐ DEV.to | ้็ผ่ | 1000ร420px๏ผๆ็ซ ๅฐ้ข |
| ๐ฅ YouTube | ๅฝฑ็ๅนณๅฐ | 1280ร720px๏ผๅฝฑ็็ธฎๅ |
| ๐ฐ Medium | ้จ่ฝๆ ผๅนณๅฐ | 1200ร630px๏ผๆ็ซ ้ ญๅ |
| ๐ Discord | ็คพ็พคๅนณๅฐ | 1200ร675px๏ผDiscord ๅตๅ ฅ |
| ๐ฌ Telegram | ็คพ็พคๅนณๅฐ | 1200ร675px๏ผ่จๆฏ้ ่ฆฝ |
| ๐ Reddit | ็คพ็พคๅนณๅฐ | 1200ร628px๏ผ่ฒผๆ้ ๅ |
| ๐ง Email | ้่จๅทฅๅ ท | 800ร400px๏ผ้ตไปถ็ฐฝๅ |
| ๐ ้็จ | ้็จๅ ดๆฏ | 1200ร800px๏ผ่ฌ่ฝๅฐบๅฏธ |
ๅ งๅปบ HTTP ไผบๆๅจ๏ผๆไพๅณๆ้ ่ฆฝ็ Web ไป้ข๏ผ
# ๅๅ Web UI๏ผ้ ่จญ้ฃๆฅๅ 8964
snapcode web
# ๆๅฎ่ช่จ้ฃๆฅๅ
snapcode web --port 8080ไธ่กๆไปค๏ผๆๅฎไธๅ๏ผ
# ๅบ็ค็จๆณ๏ผ็พๅ็จๅผ็ขผๆชๅ
snapcode screenshot -f code.py
# ๆๅฎไธป้กๅๅนณๅฐ้ ่จญ
snapcode screenshot -f code.py --theme dracula --preset twitter-x
# ่ช่จ่ฆ็ชๆจ้ก
snapcode screenshot -f code.py --title "My Awesome Code"
# ้กฏ็คบ่ก่
snapcode screenshot -f code.py --line-numbers
# ้ซไบฎๆๅฎ่ก
snapcode screenshot -f code.py --highlight 5,10,15-20
# ้ธๆ่ฆ็ชๆจฃๅผ
snapcode screenshot -f code.py --window-style macos็ด Python ๆจๆบๅฝๅผๅบซๅฏฆไฝ๏ผ็ก้ๅฎ่ฃไปปไฝ็ฌฌไธๆนไพ่ณด๏ผ
pip install snapcode-ai # ๅ
ๆญคไธๆญฅ๏ผ้็ฎฑๅณ็จๆฏๆด macOSใWindowsใLinux ไธๅคงไฝๆฅญ็ณป็ตฑ็่ฆ็ชๅค่ง๏ผ
snapcode screenshot -f code.py --window-style macos # macOS ้ขจๆ ผ
snapcode screenshot -f code.py --window-style windows # Windows ้ขจๆ ผ
snapcode screenshot -f code.py --window-style linux # Linux ้ขจๆ ผ- โ ่ก่้กฏ็คบ / ้ฑ่
- โ
ๆๅฎ่ก้ซไบฎ๏ผๆฏๆด็ฏๅ๏ผๅฆ
5,10,15-20๏ผ - โ ่ช่จ่ฆ็ชๆจ้ก
- โ HTML ่ผธๅบๆ ผๅผ
- โ ่ช่จ่ผธๅบ่ทฏๅพ
- Python 3.8 ๆๆด้ซ็ๆฌ
- pip ๅฅไปถ็ฎก็ๅจ
ๆนๅผไธ๏ผ้้ PyPI ๅฎ่ฃ๏ผๆจ่ฆ๏ผ
pip install snapcode-aiๆนๅผไบ๏ผๅพๅๅง็ขผๅฎ่ฃ
git clone https://github.com/gitstq/snapcode-ai.git
cd snapcode-ai
pip install -e .# 1. ๅฎ่ฃ
pip install snapcode-ai
# 2. ๅปบ็ซไธๅ็ฏไพ็จๅผ็ขผๆชๆก
echo 'print("Hello, SnapCode-AI! ๐")' > hello.py
# 3. ็ๆ็ฒพ็พๆชๅ
snapcode screenshot -f hello.py --theme dracula --preset wechat
# 4. ๆฅ็็ๆ็ๆชๅ
# ่ผธๅบๆชๆก้ ่จญๅฒๅญๅจ็ฎๅ็ฎ้# ๅๅไบๅๅผ Web ไป้ข
snapcode web --port 8964
# ้ๅ็่ฆฝๅจๅญๅ
# http://localhost:8964ๆ ธๅฟๆไปค๏ผ็จๆผ็ๆ็จๅผ็ขผๆชๅ๏ผ
snapcode screenshot -f <ๆชๆก่ทฏๅพ> [้ธ้
]ๅฎๆดๅๆธๅ่กจ๏ผ
| ๅๆธ | ็ธฎๅฏซ | ่ชชๆ | ้ ่จญๅผ |
|---|---|---|---|
--file |
-f |
็จๅผ็ขผๆชๆก่ทฏๅพ๏ผๅฟ ๅกซ๏ผ | - |
--theme |
-t |
ไธป้กๅ็จฑ | dracula |
--preset |
-p |
็คพ็พคๅนณๅฐ้ ่จญ | wechat |
--output |
-o |
่ผธๅบๆชๆก่ทฏๅพ | ่ชๅ็ๆ |
--title |
-T |
่ฆ็ชๆจ้ก | ๆชๆกๅ็จฑ |
--line-numbers |
-n |
้กฏ็คบ่ก่ | True |
--highlight |
-H |
้ซไบฎ่ก๏ผๅฆ 5,10,15-20๏ผ |
- |
--window-style |
-w |
่ฆ็ชๆจฃๅผ๏ผmacos/windows/linux๏ผ | macos |
--format |
-F |
่ผธๅบๆ ผๅผ๏ผpng/html๏ผ | png |
--padding |
-P |
ๅ ง้่ทๅคงๅฐ | 40 |
ไฝฟ็จ็ฏไพ๏ผ
# ็ๆ้ฉ้
X/Twitter ็ Dracula ไธป้กๆชๅ
snapcode screenshot -f main.py --theme dracula --preset twitter-x
# ็ๆๅฐ็ด
ๆธ้ขจๆ ผ็็จๅผ็ขผๅก็
snapcode screenshot -f app.ts --theme tokyo-night --preset xiaohongshu
# ็ๆ GitHub README Banner
snapcode screenshot -f config.json --theme github-dark --preset github-readme
# ้ซไบฎ้้ต็จๅผ็ขผ่ก
snapcode screenshot -f server.go --theme nord --highlight 10-25,30
# ๅฏๅบ็บ HTML ๆ ผๅผ
snapcode screenshot -f style.css --theme catppuccin-mocha --format htmlๅๅไบๅๅผ Web UI ไผบๆๅจ๏ผ
snapcode web [้ธ้
]| ๅๆธ | ่ชชๆ | ้ ่จญๅผ |
|---|---|---|
--port |
ๆๅ้ฃๆฅๅ | 8964 |
--host |
็ถๅฎไฝๅ | 127.0.0.1 |
ๆฅ็ๆๆๅฏ็จไธป้ก๏ผ
snapcode themes่ผธๅบ็ฏไพ๏ผ
๐จ Available Themes:
๐ Dark: catppuccin-mocha, dracula, tokyo-night, nord, monokai, ...
โ๏ธ Light: github-light, solarized-light, one-light, ...
๐ Special: catppuccin-latte, gruvbox-light, snazzy, ...
ๆฅ็ๆๆๅฏ็จๅนณๅฐ้ ่จญ๏ผ
snapcode presets่ผธๅบ็ฏไพ๏ผ
๐ฑ Available Presets:
๐จ๐ณ Domestic: wechat, xiaohongshu, bilibili, douyin, zhihu, weibo
๐ Global: twitter-x, linkedin, instagram, facebook
๐จโ๐ป Developer: github-readme, dev-to
๐ฅ Video: youtube
๐ฐ Blog: medium
๐ฌ Community: discord, telegram, reddit
๐ง Other: email, generic
ๆฅ็ๆๆๆฏๆด็็จๅผ่ช่จ๏ผ
snapcode languagesๆฅ็็ๆฌ่ณ่จ๏ผ
snapcode versionSnapCode-AI ็่จญ่จ้ตๅพชไปฅไธๆ ธๅฟๅๅ๏ผ
-
้ถไพ่ณดๅฒๅญธ ๐ฆ
- ๆ ธๅฟๅ่ฝๅฎๅ จๅบๆผ Python ๆจๆบๅฝๅผๅบซๅฏฆไฝ
- ็ก้ๅฎ่ฃไปปไฝ็ฌฌไธๆนๅฅไปถ๏ผ้ไฝ็ฐๅข้ ็ฝฎๆๆฌ
- ๆๅๅๅ้ๅบฆ๏ผๆธๅฐๆฝๅจ็ๅฎๅ จ้ขจ้ช
-
ไธป้กๅผๆ่งฃ่ฆ ๐จ
- ไธป้ก่ๆธฒๆๅผๆๅฎๅ จๅ้ข
- ๆก็จ JSON ้ ็ฝฎๅฎ็พฉไธป้ก๏ผไพฟๆผ็คพ็พค่ฒข็ป
- ๆฏๆดไฝฟ็จ่ ่ช่จไธป้กๆดๅ
-
้ ่จญ็ณป็ตฑ้ๆดป ๐ฑ
- ็คพ็พคๅนณๅฐ้ ่จญ็จ็ซๆผไธป้ก็ณป็ตฑ
- ้ ่จญๅฎ็พฉไบๅฐบๅฏธใๅ่งใ้ฐๅฝฑ็ญไฝๅฑๅๆธ
- ๆฐๅขๅนณๅฐๅช้ๆฐๅขไธๅ้ ็ฝฎๆชๆก
-
้ๆจกๅผไบๅ ๐ฑ๏ธ
- CLI ๆจกๅผ๏ผ้ฉๅ่ชๅๅ่ ณๆฌๅ CI/CD ๆดๅ
- Web UI ๆจกๅผ๏ผ้ฉๅไบๅๅผๆข็ดขๅๅณๆ้ ่ฆฝ
- ๅ ฉ็จฎๆจกๅผๅ ฑไบซๅไธๅฅๆ ธๅฟๆธฒๆๅผๆ
- 21 ๆฌพ็ฒพ็พไธป้ก
- 20+ ็จๅผ่ช่จ่ชๆณ้ซไบฎ
- 19 ๅ็คพ็พคๅนณๅฐ้ ่จญ
- ไบๅๅผ Web UI
- CLI ๅฝไปคๅๅทฅๅ ท
- ้ถๆ ธๅฟไพ่ณด
- ๅค็จฎ่ฆ็ชๆจฃๅผ
- ่ก่้กฏ็คบ/้ฑ่ใ่ก้ซไบฎ
- HTML ่ผธๅบๆ ผๅผ
- ่ช่จไธป้ก็ทจ่ผฏๅจ๏ผWeb UI ๅ งๅปบ๏ผ
- ๆน้ๆชๅ็ๆๆจกๅผ
- ๆดๅค็จๅผ่ช่จๆฏๆด๏ผScalaใElixirใHaskell ็ญ๏ผ
- ๆผธๅฑค่ๆฏ่่ช่จๆตฎๆฐดๅฐ
- AI ๆบๆ งไธป้กๆจ่ฆ๏ผๆ นๆ็จๅผ็ขผๅ งๅฎน่ชๅๅน้ ๆไฝณไธป้ก๏ผ
- VS Code / JetBrains ๅคๆๆดๅ
- API ๆๅๆจกๅผ๏ผๆฏๆด้ ็ซฏๅผๅซ๏ผ
- ๅ้ไธป้กๅ ฑไบซ่ๅไฝ
- ็ทไธ SaaS ๆๅ
- ็จๅผ็ขผๅ็ซ GIF ๅฏๅบ
- ๆทฑๅบฆ็ทจ่ผฏๅจๆดๅ๏ผCursorใWindsurf ็ญ๏ผ
- ็คพ็พคไธป้กๅธๅ ด
# 1. ๅฎ่ฃๅปบ็ฝฎๅทฅๅ
ท
pip install build twine
# 2. ๅปบ็ฝฎ็ผ่กๅ
python -m build
# 3. ๆชขๆฅๅฅไปถๅ
งๅฎน
twine check dist/*
# 4. ไธๅณๅฐ PyPI
twine upload dist/*FROM python:3.11-slim
WORKDIR /app
COPY . .
RUN pip install snapcode-ai
EXPOSE 8964
CMD ["snapcode", "web", "--port", "8964", "--host", "0.0.0.0"]ๅปบ็ฝฎ่ๅท่ก๏ผ
# ๅปบ็ฝฎๆ ๅ
docker build -t snapcode-ai .
# ๅท่กๅฎนๅจ
docker run -p 8964:8964 snapcode-ai#!/bin/bash
# deploy.sh - SnapCode-AI ๅฟซ้้จ็ฝฒ่
ณๆฌ
echo "๐ ๆญฃๅจ้จ็ฝฒ SnapCode-AI..."
# ๅฎ่ฃ
pip install snapcode-ai
# ้ฉ่ญๅฎ่ฃ
snapcode version
echo "โ
้จ็ฝฒๅฎๆ๏ผ"
echo "๐ก ๅท่ก 'snapcode web' ๅๅ Web UI"
echo "๐ก ๅท่ก 'snapcode screenshot -f your_code.py' ็ๆๆชๅ"snapcode-ai/
โโโ snapcode_ai/ # ๆ ธๅฟๅฅไปถ
โ โโโ __init__.py
โ โโโ cli.py # CLI ้ฒๅ
ฅ้ป
โ โโโ web.py # Web UI ไผบๆๅจ
โ โโโ renderer/ # ๆธฒๆๅผๆ
โ โ โโโ screenshot.py # ๆชๅๆธฒๆ
โ โ โโโ html.py # HTML ๆธฒๆ
โ โโโ themes/ # ไธป้กๅฎ็พฉ
โ โ โโโ dark/ # ๆทฑ่ฒไธป้ก
โ โ โโโ light/ # ๆทบ่ฒไธป้ก
โ โโโ presets/ # ๅนณๅฐ้ ่จญ
โ โโโ languages/ # ่ชๆณ้ซไบฎๅฎ็พฉ
โ โโโ utils/ # ๅทฅๅ
ทๅฝๅผ
โโโ tests/ # ๆธฌ่ฉฆ
โโโ setup.py # ๅฎ่ฃ้
็ฝฎ
โโโ pyproject.toml # ๅฐๆก้
็ฝฎ
โโโ Dockerfile # Docker ้
็ฝฎ
โโโ README.md # ๆฌๆชๆก
ๆๅๆญก่ฟไธฆๆ่ฌๆฏไธไฝ่ฒข็ป่ ๏ผ็ก่ซไฝ ๆฏไฟฎๅพฉไบไธๅ Bugใๆฐๅขไบไธๅๆฐไธป้ก๏ผ้ๆฏๆน้ฒไบๆไปถ๏ผๆฏไธไปฝ่ฒข็ป้ฝ่ฎ SnapCode-AI ่ฎๅพๆดๅฅฝใ
1. Fork ไธฆๅ ้ๅฐๆก
git clone https://github.com/gitstq/snapcode-ai.git
cd snapcode-ai2. ๅปบ็ซๅ่ฝๅๆฏ
git checkout -b feature/your-feature-name3. ้็ผ่ๆธฌ่ฉฆ
# ๅฎ่ฃ้็ผไพ่ณด
pip install -e ".[dev]"
# ๅท่กๆธฌ่ฉฆ
python -m pytest tests/
# ็จๅผ็ขผๆ ผๅผๅ
python -m black snapcode_ai/4. ๆไบค็จๅผ็ขผ
git add .
git commit -m "feat: ๆฐๅขๆฐๅ่ฝๆ่ฟฐ"
git push origin feature/your-feature-name5. ็ผ่ตท Pull Request
ๅจ GitHub ไธๅปบ็ซ Pull Request๏ผๆ่ฟฐไฝ ็่ฎๆดๅ งๅฎนใ
- ๅจ
snapcode_ai/themes/็ฎ้ไธๅปบ็ซไธป้ก้ ็ฝฎๆชๆก - ๅฎ็พฉ่ๆฏ่ฒใๅๆฏ่ฒใ่ชๆณ้ซไบฎ่ฒ็ญๅๆธ
- ๆไบค PR ไธฆ้ๅธถไธป้ก้ ่ฆฝๆชๅ
- ๅจ
snapcode_ai/presets/็ฎ้ไธๅปบ็ซ้ ่จญ้ ็ฝฎๆชๆก - ๅฎ็พฉ็ฎๆจๅฐบๅฏธใๅ่งใ้ฐๅฝฑ็ญๅๆธ
- ๆไบค PR ไธฆ่ชชๆๅนณๅฐ้ฉ้ ็ดฐ็ฏ
- ้ตๅพช Conventional Commits ๆไบค่ฆ็ฏ
- ็จๅผ็ขผ้ขจๆ ผ้ตๅพช PEP 8
- ๆฐๅขๅ ๅ็่จป่งฃๅๆไปถ
- ็ขบไฟๆๆๆธฌ่ฉฆ้้
ๆฌๅฐๆกๅบๆผ MIT License ้ๆบใ
MIT License
Copyright (c) 2024 gitstq
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Made with โค๏ธ by gitstq
ๅฆๆไฝ ่ฆบๅพ SnapCode-AI ๅฐไฝ ๆๅนซๅฉ๏ผ่ซ็ตฆๅฐๆกไธๅ โญ Star๏ผ
โญ Star this repo if you find it helpful!
SnapCode-AI is an AI-powered code screenshot beautifier designed specifically for developers. It transforms boring code snippets into stunning visuals that you can share across social platforms with a single click.
| Pain Point | SnapCode-AI Solution |
|---|---|
| ๐ฉ Ugly, unprofessional code screenshots | ๐จ 21 beautifully crafted themes covering popular editor styles |
| ๐ซ Different size requirements per platform | ๐ฑ 19 social platform presets with one-click optimal sizing |
| ๐ฐ Incomplete syntax highlighting | ๐ป 20+ programming languages with precise colorization |
| ๐ญ Too many dependencies to install | โก Zero core dependencies, pure Python standard library |
| ๐ต Tools too complex to use | ๐ฑ๏ธ Interactive Web UI + clean CLI, ready to use out of the box |
Turn code into art, make sharing a joy.
From classic to trendy, there's always one that fits your style:
| Category | Themes |
|---|---|
| ๐ Dark | Catppuccin Mocha, Dracula, Tokyo Night, Nord, Monokai, GitHub Dark, One Dark Pro, Gruvbox Dark, Solarized Dark, VS Code Dark, Atom One Dark, Palenight |
| โ๏ธ Light | GitHub Light, Solarized Light, One Light, VS Code Light, Atom One Light |
| ๐ Special | Catppuccin Latte, Gruvbox Light, Snazzy, Ayu Dark |
Full syntax highlighting support for the following languages:
Python ยท JavaScript ยท TypeScript ยท Go ยท Rust ยท Java ยท C ยท C++ ยท Ruby ยท PHP
Swift ยท Kotlin ยท HTML ยท CSS ยท JSON ยท SQL ยท Bash ยท Markdown ยท YAML ยท Dockerfile
Generate code screenshots optimized for each platform's ideal dimensions:
| Platform | Category | Description |
|---|---|---|
| ๐จ๐ณ WeChat Moments | Domestic (CN) | 1080ร1080px, optimal for Moments |
| ๐ Xiaohongshu | Domestic (CN) | 1080ร1440px, 3:4 portrait card |
| ๐บ Bilibili | Domestic (CN) | 1920ร1080px, 16:9 landscape cover |
| ๐ต TikTok / Douyin | Domestic (CN) | 1080ร1920px, 9:16 portrait |
| โ Zhihu | Domestic (CN) | 1200ร675px, 16:9 image card |
| ๐ข Weibo | Domestic (CN) | 1080ร1080px, square image |
| ๐ฆ X / Twitter | International | 1600ร900px, Twitter optimal ratio |
| ๐ผ LinkedIn | International | 1200ร627px, LinkedIn article image |
| ๐ธ Instagram | International | 1080ร1080px, square post |
| ๐ Facebook | International | 1200ร630px, Facebook share image |
| ๐ GitHub README | Developer | 1280ร640px, README Banner |
| ๐ DEV.to | Developer | 1000ร420px, article cover |
| ๐ฅ YouTube | Video | 1280ร720px, video thumbnail |
| ๐ฐ Medium | Blog | 1200ร630px, article header |
| ๐ Discord | Community | 1200ร675px, Discord embed |
| ๐ฌ Telegram | Community | 1200ร675px, message preview |
| ๐ Reddit | Community | 1200ร628px, post image |
| ๐ง Email | Communication | 800ร400px, email signature |
| ๐ Generic | Universal | 1200ร800px, all-purpose size |
Built-in HTTP server with a real-time preview web interface:
# Launch Web UI on default port 8964
snapcode web
# Specify a custom port
snapcode web --port 8080One command is all you need:
# Basic usage: beautify a code screenshot
snapcode screenshot -f code.py
# Specify theme and platform preset
snapcode screenshot -f code.py --theme dracula --preset twitter-x
# Custom window title
snapcode screenshot -f code.py --title "My Awesome Code"
# Show line numbers
snapcode screenshot -f code.py --line-numbers
# Highlight specific lines
snapcode screenshot -f code.py --highlight 5,10,15-20
# Choose window style
snapcode screenshot -f code.py --window-style macosBuilt entirely with the Python standard library โ no third-party packages required:
pip install snapcode-ai # That's it, ready to goSupports macOS, Windows, and Linux window chrome appearances:
snapcode screenshot -f code.py --window-style macos # macOS style
snapcode screenshot -f code.py --window-style windows # Windows style
snapcode screenshot -f code.py --window-style linux # Linux style- โ Show / hide line numbers
- โ
Highlight specific lines (supports ranges like
5,10,15-20) - โ Custom window title
- โ HTML output format
- โ Custom output path
- Python 3.8 or higher
- pip package manager
Option 1: Install via PyPI (Recommended)
pip install snapcode-aiOption 2: Install from Source
git clone https://github.com/gitstq/snapcode-ai.git
cd snapcode-ai
pip install -e .# 1. Install
pip install snapcode-ai
# 2. Create a sample code file
echo 'print("Hello, SnapCode-AI! ๐")' > hello.py
# 3. Generate a beautiful screenshot
snapcode screenshot -f hello.py --theme dracula --preset wechat
# 4. Check the generated screenshot
# Output file is saved in the current directory by default# Start the interactive web interface
snapcode web --port 8964
# Open your browser and visit
# http://localhost:8964The core command for generating code screenshots:
snapcode screenshot -f <file_path> [options]Full Parameter List:
| Parameter | Short | Description | Default |
|---|---|---|---|
--file |
-f |
Code file path (required) | - |
--theme |
-t |
Theme name | dracula |
--preset |
-p |
Social platform preset | wechat |
--output |
-o |
Output file path | Auto-generated |
--title |
-T |
Window title | Filename |
--line-numbers |
-n |
Show line numbers | True |
--highlight |
-H |
Highlight lines (e.g. 5,10,15-20) |
- |
--window-style |
-w |
Window style (macos/windows/linux) | macos |
--format |
-F |
Output format (png/html) | png |
--padding |
-P |
Padding size | 40 |
Usage Examples:
# Generate a Dracula-themed screenshot optimized for X/Twitter
snapcode screenshot -f main.py --theme dracula --preset twitter-x
# Generate a Xiaohongshu-style code card
snapcode screenshot -f app.ts --theme tokyo-night --preset xiaohongshu
# Generate a GitHub README Banner
snapcode screenshot -f config.json --theme github-dark --preset github-readme
# Highlight key code lines
snapcode screenshot -f server.go --theme nord --highlight 10-25,30
# Export as HTML format
snapcode screenshot -f style.css --theme catppuccin-mocha --format htmlLaunch the interactive Web UI server:
snapcode web [options]| Parameter | Description | Default |
|---|---|---|
--port |
Server port | 8964 |
--host |
Bind address | 127.0.0.1 |
List all available themes:
snapcode themesSample output:
๐จ Available Themes:
๐ Dark: catppuccin-mocha, dracula, tokyo-night, nord, monokai, ...
โ๏ธ Light: github-light, solarized-light, one-light, ...
๐ Special: catppuccin-latte, gruvbox-light, snazzy, ...
List all available platform presets:
snapcode presetsSample output:
๐ฑ Available Presets:
๐จ๐ณ Domestic: wechat, xiaohongshu, bilibili, douyin, zhihu, weibo
๐ Global: twitter-x, linkedin, instagram, facebook
๐จโ๐ป Developer: github-readme, dev-to
๐ฅ Video: youtube
๐ฐ Blog: medium
๐ฌ Community: discord, telegram, reddit
๐ง Other: email, generic
List all supported programming languages:
snapcode languagesShow version information:
snapcode versionSnapCode-AI is designed around the following core principles:
-
Zero-Dependency Philosophy ๐ฆ
- Core functionality is built entirely on the Python standard library
- No third-party packages needed, reducing environment setup complexity
- Faster startup times and reduced security surface area
-
Decoupled Theme Engine ๐จ
- Themes are completely separated from the rendering engine
- JSON-based theme definitions make community contributions easy
- Supports user-defined custom theme extensions
-
Flexible Preset System ๐ฑ
- Social platform presets are independent from the theme system
- Presets define dimensions, border radius, shadows, and other layout parameters
- Adding a new platform requires only a single configuration file
-
Dual-Mode Interaction ๐ฑ๏ธ
- CLI mode: ideal for automation scripts and CI/CD integration
- Web UI mode: perfect for interactive exploration and real-time preview
- Both modes share the same core rendering engine
- 21 beautiful themes
- 20+ programming language syntax highlighting
- 19 social platform presets
- Interactive Web UI
- CLI command-line tool
- Zero core dependencies
- Multiple window styles
- Line number show/hide, line highlighting
- HTML output format
- Custom theme editor (built into Web UI)
- Batch screenshot generation mode
- Additional language support (Scala, Elixir, Haskell, etc.)
- Gradient backgrounds and custom watermarks
- AI-powered theme recommendations (auto-match best theme based on code content)
- VS Code / JetBrains plugin integration
- API service mode (remote invocation support)
- Team theme sharing and collaboration
- Online SaaS service
- Code animation GIF export
- Deep editor integration (Cursor, Windsurf, etc.)
- Community theme marketplace
# 1. Install build tools
pip install build twine
# 2. Build distribution packages
python -m build
# 3. Check package contents
twine check dist/*
# 4. Upload to PyPI
twine upload dist/*FROM python:3.11-slim
WORKDIR /app
COPY . .
RUN pip install snapcode-ai
EXPOSE 8964
CMD ["snapcode", "web", "--port", "8964", "--host", "0.0.0.0"]Build and run:
# Build the image
docker build -t snapcode-ai .
# Run the container
docker run -p 8964:8964 snapcode-ai#!/bin/bash
# deploy.sh - SnapCode-AI Quick Deployment Script
echo "๐ Deploying SnapCode-AI..."
# Install
pip install snapcode-ai
# Verify installation
snapcode version
echo "โ
Deployment complete!"
echo "๐ก Run 'snapcode web' to start the Web UI"
echo "๐ก Run 'snapcode screenshot -f your_code.py' to generate screenshots"snapcode-ai/
โโโ snapcode_ai/ # Core package
โ โโโ __init__.py
โ โโโ cli.py # CLI entry point
โ โโโ web.py # Web UI server
โ โโโ renderer/ # Rendering engine
โ โ โโโ screenshot.py # Screenshot renderer
โ โ โโโ html.py # HTML renderer
โ โโโ themes/ # Theme definitions
โ โ โโโ dark/ # Dark themes
โ โ โโโ light/ # Light themes
โ โโโ presets/ # Platform presets
โ โโโ languages/ # Syntax highlighting definitions
โ โโโ utils/ # Utility functions
โโโ tests/ # Tests
โโโ setup.py # Installation config
โโโ pyproject.toml # Project config
โโโ Dockerfile # Docker config
โโโ README.md # This file
We welcome and appreciate every contributor! Whether you fix a bug, add a new theme, or improve the documentation โ every contribution makes SnapCode-AI better.
1. Fork and Clone the Repository
git clone https://github.com/gitstq/snapcode-ai.git
cd snapcode-ai2. Create a Feature Branch
git checkout -b feature/your-feature-name3. Develop and Test
# Install dev dependencies
pip install -e ".[dev]"
# Run tests
python -m pytest tests/
# Format code
python -m black snapcode_ai/4. Commit Your Changes
git add .
git commit -m "feat: add new feature description"
git push origin feature/your-feature-name5. Open a Pull Request
Create a Pull Request on GitHub describing your changes.
- Create a theme configuration file in the
snapcode_ai/themes/directory - Define background color, foreground color, syntax highlight colors, etc.
- Submit a PR with a preview screenshot of the theme
- Create a preset configuration file in the
snapcode_ai/presets/directory - Define target dimensions, border radius, shadows, and other parameters
- Submit a PR with details about the platform adaptation
- Follow the Conventional Commits specification
- Adhere to PEP 8 code style
- Add thorough comments and documentation
- Ensure all tests pass
This project is licensed under the MIT License.
MIT License
Copyright (c) 2024 gitstq
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Made with โค๏ธ by gitstq
If you find SnapCode-AI helpful, please give it a โญ Star!