迁移
profile-graphics migrate 读取你已有的卡片 URL 并写出对应的配置,让卡片来自你自己的 CI,而不是共享服务器。
转换你的 README
用 --readme 让命令读取你的 README,或把卡片 URL 作为参数传入。它会打印每个 URL 及其对应的卡片,列出跳过的 URL,然后打印配置或写入 --output。例如,下面的 README 会变成其后的配置。
shell
npx profile-graphics migrate --readme README.md --output profile-graphics.yml
npx profile-graphics migrate "https://github-readme-stats.vercel.app/api?username=octocat"
README.md




profile-graphics.yml
# yaml-language-server: $schema=https://unpkg.com/profile-graphics/profile-graphics.schema.json
provider:
type: github
user: octocat
charts:
- summary
- langs
- streak
- trophy
theme:
preset: tokyo-night
svg:
frame: none
cards:
langs:
style: donut-compact
count: 8
trophy:
columns: 4
max: 8
然后添加快速开始中的工作流,并用生成的文件替换旧的图片 URL。
支持的卡片
| 服务 | URL 包含 | 卡片 |
|---|---|---|
| github-readme-stats |
/api
|
summary
|
| github-readme-stats |
/api/top-langs
|
langs
|
| github-readme-stats |
/api/wakatime
|
coding-languages
|
| github-readme-streak-stats |
streak-stats
|
streak
|
| github-profile-trophy |
github-profile-trophy
|
trophy
|
| github-readme-activity-graph |
activity-graph
|
activity
|
| github-profile-summary-cards |
profile-details, productive-time, stats, repos-per-language, most-commit-language
|
profile-details, productive-time, summary, langs
|
选项对照
| 原选项 | profile-graphics |
|---|---|
username, user
|
provider.user
|
theme
|
theme.preset
|
hide_border=true
|
svg.frame: none
|
locale
|
calendar.locale
|
layout
|
cards.langs.style
|
langs_count
|
cards.langs.count
|
hide
|
cards.langs.exclude
|
column, row
|
cards.trophy.columns, cards.trophy.max
|
days
|
cards.activity.days
|
主题名会匹配到 43 个预设,包括 tokyonight、onedark、gruvbox、dark 和 highcontrast 等别名。layout=compact 变为 donut-compact 样式,donut、donut-vertical 和 pie 变为 donut。
自托管的兼容 URL
如果你运行自己的卡片服务器(profile-graphics serve 或 profile-graphics/server 处理函数),可以保留旧的图片 URL,只替换域名:服务器会用与 migrate 相同的对照关系响应 github-readme-stats 和 github-readme-streak-stats 的路径和查询参数。
README.md



| 路径 | 卡片 |
|---|---|
/api
|
summary
|
/api/top-langs
|
langs
|
/api/pin
|
repo-card
|
/api/wakatime
|
wakatime
|
/streak, /?user=
|
streak
|
| 原参数 | profile-graphics |
|---|---|
username, user
|
provider.user
|
hide, show
|
cards.summary.metrics
|
hide_rank, rank_icon
|
cards.summary.show_rank, rank_style
|
include_all_commits
|
provider.commits_scope: all
|
count_private
|
provider.count_private
|
commits_year
|
calendar.year
|
number_format, short_numbers
|
svg.number_format
|
custom_title, hide_title
|
cards.<card>.title, hide_title
|
card_width, card_height
|
cards.<card>.width, height
|
hide_border, border_radius
|
svg.frame: none, svg.frame_radius
|
disable_animations
|
svg.animation: none
|
theme, locale
|
theme.preset, calendar.locale
|
title_color, icon_color
|
theme.colors.chart.accent, accent2
|
text_color, bg_color, border_color
|
theme.colors.text, background, border
|
layout, langs_count, hide
|
cards.langs.style, count, exclude
|
exclude_repo
|
provider.exclude_repos
|
repo, show_owner, description_lines_count
|
cards.repo_card.repo, show_owner, description_lines
|
layout, langs_count, display_format
|
cards.wakatime.layout, limit, display_format
|
hide, range, hide_progress
|
cards.wakatime.hide, range, layout: list
|
mode, exclude_days, date_format
|
cards.streak.mode, exclude_days, date_format
|
hide_total_contributions, hide_current_streak, hide_longest_streak
|
cards.streak.show
|
type
|
output.format
|
background, border
|
theme.colors.background, border
|
ring, fire, currStreakNum, sideNums, currStreakLabel, sideLabels, dates, stroke
|
cards.streak.colors
|
- 未知参数会被忽略,
show_icons、line_height、text_bold、number_precision、size_weight、count_weight和stats_format也一样。无效值返回400,并在消息中指出参数名。 - 没有对应预设的主题会回退到默认主题;颜色是带或不带
#的十六进制值,bg_color也接受渐变,例如30,e96443,904e95。 - 卡片使用服务器令牌为 GitHub 绘制。查询永远不会改变令牌、API 主机、数据源或输出:不支持
api_domain,/api/wakatime显示服务器WAKATIME_API_KEY对应的账号。 - 不支持 streak-stats 的
type=json;/github/<user>.json以 JSON 返回统计数据。
差异
- 没有对应预设的主题会被丢弃,配置回退到原生自动主题。
- 这些服务的自定义颜色、标题和其他选项不会迁移;请用
theme.colors、svg.frame_title和cards设置。 - 以找到的第一个用户名为准;没有找到时,配置中写的是
your-username。 - 配置始终使用
provider: github;如需 GitLab 或 Codeberg,请修改。