README を変換する

--readme でコマンドに README を指定するか、カードの 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
![Stats](https://github-readme-stats.vercel.app/api?username=octocat&theme=tokyonight&hide_border=true)
![Languages](https://github-readme-stats.vercel.app/api/top-langs?username=octocat&layout=compact&langs_count=8)
![Streak](https://streak-stats.demolab.com?user=octocat&theme=tokyonight)
![Trophies](https://github-profile-trophy.vercel.app/?username=octocat&column=4&row=2)
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

テーマ名は、tokyonight、onedark、gruvbox、dark、highcontrast などのエイリアスも含めて 43 のプリセットに対応づけられます。layout=compact は donut-compact スタイルに、donut、donut-vertical、pie は donut になります。

セルフホスト向けのドロップイン URL

自分のカードサーバー(profile-graphics serve または profile-graphics/server ハンドラー)を動かしているなら、古い画像 URL をそのまま使い、ドメインだけを差し替えられます。サーバーは github-readme-stats と github-readme-streak-stats のパスとクエリパラメーターに、migrate と同じ対応で応答します。

README.md
![Stats](https://cards.example.com/api?username=octocat&show_icons=true&theme=radical)
![Languages](https://cards.example.com/api/top-langs?username=octocat&layout=compact)
![Streak](https://cards.example.com/?user=octocat&theme=dark)
パス カード
/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 が返ります。
  • 対応するプリセットのないテーマはデフォルトのテーマになります。色は # の有無を問わない 16 進数で、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 の場合は変更してください。