การตั้งค่า
profile-graphics.yml เป็นตัวเลือกเสริม แต่เป็นวิธีที่ดีที่สุดที่จะทำให้การ์ดทำซ้ำได้ใน CI
ตัวอย่างเต็ม
provider:
type: github
user: octocat
include_private: false
charts: [streak, summary, langs, calendar]
output:
dir: profile-graphics
format: svg
layout: separate
raster_background: auto
calendar:
mode: rolling
timezone: Europe/Berlin
locale: en
theme:
mode: auto
native: true
dark_mode_pair: false
svg:
frame: border
frame_radius: 8
frame_title: ""
hide_title: false
number_format: short
animation: none
accessibility: true
cards:
langs:
style: donut
count: 6
exclude: [HTML, CSS]
summary:
metrics: [stars, commits, prs, reviews]
calendar:
weeks: 52
show_months: true
กลุ่มตัวเลือก
| กลุ่ม | ตัวเลือก |
|---|---|
provider
|
type, user, token, base_url, source, include_private, include_forks, exclude_repos, affiliations, merge
|
output
|
dir, prefix, format, layout, columns, raster_background
|
calendar
|
mode, year, timezone, locale
|
theme
|
preset, custom, mode, native, dark_mode_pair, background, colors
|
svg
|
frame, frame_radius, frame_title, hide_title, number_format, animation, animation_duration, accessibility
|
cards
|
activity, langs, streak, summary, productive_time, punch_card, calendar, calendar_3d, profile_details, profile_card, trophy, repos, coding_time, coding_list, views
|
charts ระบุการ์ดที่จะเรนเดอร์ตามลำดับ ดูการ์ด สำหรับการ์ดแต่ละใบและตัวเลือกใน cards
calendar.timezone เป็นชื่อ IANA เช่น Europe/Berlin (ค่าเริ่มต้น UTC) กำหนดว่าอีเวนต์เป็นของวันไหน ความต่อเนื่องสิ้นสุดเมื่อใด และการ์ดช่วงเวลาที่มีประสิทธิภาพนับชั่วโมงไหน
theme.background รับสี transparent หรือไล่สีเชิงเส้น เช่น 30,#e96443,#904e95 ดูพื้นหลังไล่สี
พรีเซ็ต review
review ใน charts ขยายเป็น summary, streak, calendar, langs, punch-card และ repos ตามลำดับนี้: รีวิวโปรไฟล์ครบในคำเดียว ระบุการ์ดอื่นก่อนหรือหลังได้ การ์ดที่ซ้ำสองครั้งจะเรนเดอร์ครั้งเดียว
charts: [review, activity]
แฟล็ก CLI และอินพุตของ Action
ตัวเลือกส่วนใหญ่ตั้งได้โดยไม่ต้องแก้ YAML: ส่งเป็นแฟล็ก CLI หรืออินพุตของ GitHub Action แฟล็กและอินพุตมีผลเหนือไฟล์การตั้งค่า รายการอย่าง charts คั่นด้วยจุลภาค provider.merge ธีมที่กำหนดเอง การแทนที่สี และขนาดการ์ดตั้งได้ใน YAML เท่านั้น
| พาธในการตั้งค่า | แฟล็ก CLI | อินพุตของ Action |
|---|---|---|
provider.type
|
--provider
|
provider
|
provider.user
|
--user
|
user
|
provider.token
|
--token
|
token
|
provider.base_url
|
--base-url
|
base_url
|
provider.source
|
--source
|
source
|
provider.include_private
|
--include-private
|
include_private
|
provider.include_forks
|
--include-forks
|
include_forks
|
provider.exclude_repos
|
--exclude-repos
|
exclude_repos
|
provider.affiliations
|
--affiliations
|
affiliations
|
provider.scope
|
--scope
|
scope
|
provider.include_orgs
|
--include-orgs
|
include_orgs
|
provider.exclude_orgs
|
--exclude-orgs
|
exclude_orgs
|
provider.count_private
|
--count-private
|
count_private
|
provider.count_own_stars
|
--count-own-stars
|
count_own_stars
|
charts
|
--charts
|
charts
|
output.dir
|
--output
|
output
|
output.prefix
|
--prefix
|
prefix
|
output.format
|
--format
|
format
|
output.layout
|
--layout
|
layout
|
output.columns
|
--dashboard-columns
|
dashboard_columns
|
output.raster_background
|
--raster-background
|
raster_background
|
calendar.year
|
--year
|
year
|
calendar.mode
|
--calendar-mode
|
calendar_mode
|
calendar.timezone
|
--timezone
|
timezone
|
calendar.locale
|
--locale
|
locale
|
theme.preset
|
--theme
|
theme
|
theme.mode
|
--theme-mode
|
theme_mode
|
theme.native
|
--native-theme
|
native_theme
|
theme.dark_mode_pair
|
--dark-mode-pair
|
dark_mode_pair
|
theme.background
|
--background
|
background
|
svg.frame
|
--frame
|
frame
|
svg.frame_radius
|
--frame-radius
|
frame_radius
|
svg.frame_title
|
--frame-title
|
frame_title
|
svg.hide_title
|
--hide-title
|
hide_title
|
svg.animation
|
--animation
|
animation
|
svg.animation_duration
|
--animation-duration
|
animation_duration
|
svg.number_format
|
--number-format
|
number_format
|
svg.accessibility
|
--accessibility
|
accessibility
|
cards.activity.days
|
--activity-days
|
activity_days
|
cards.activity.show_grid
|
--activity-grid
|
activity_grid
|
cards.activity.show_points
|
--activity-points
|
activity_points
|
cards.activity.show_average
|
--activity-average
|
activity_average
|
cards.langs.count
|
--langs-count
|
langs_count
|
cards.langs.style
|
--langs-style
|
langs_style
|
cards.langs.exclude
|
--langs-exclude
|
langs_exclude
|
cards.summary.metrics
|
--summary-metrics
|
summary_metrics
|
cards.streak.mode
|
--streak-mode
|
streak_mode
|
cards.streak.exclude_days
|
--exclude-days
|
exclude_days
|
cards.streak.range
|
--streak-range
|
streak_range
|
cards.summary.show_rank
|
--summary-rank
|
summary_rank
|
cards.summary.rank_style
|
--rank-style
|
rank_style
|
cards.punch_card.week_start
|
--week-start
|
week_start
|
cards.productive_time.hour_format
|
--hour-format
|
hour_format
|
cards.calendar.weeks
|
--calendar-weeks
|
calendar_weeks
|
cards.calendar.show_months
|
--calendar-months
|
calendar_months
|
cards.profile_details.show_chart
|
--profile-chart
|
profile_chart
|
cards.profile_card.show_avatar
|
--profile-avatar
|
profile_avatar
|
cards.trophy.columns
|
--trophy-columns
|
trophy_columns
|
cards.trophy.max
|
--trophy-max
|
trophy_max
|
cards.repos.source
|
--repos-source
|
repos_source
|
cards.repos.count
|
--repos-count
|
repos_count
|
cards.calendar_3d.weeks
|
--calendar-3d-weeks
|
calendar_3d_weeks
|
cards.coding_time.days
|
--coding-days
|
coding_days
|
cards.coding_list.count
|
--coding-count
|
coding_count
|
cards.views.style
|
--views-style
|
views_style
|
cards.views.label
|
--views-label
|
views_label
|
cards.views.start
|
--views-start
|
views_start
|
ช่วงปฏิทิน
calendar.mode กำหนดวันที่ที่การ์ดทุกใบครอบคลุม current-year (ค่าเริ่มต้น) คือมกราคมถึงธันวาคมของปีนี้ last-year ครอบคลุมปีก่อน และ rolling แสดงสิบสองเดือนล่าสุดจนถึงวันนี้ เหมือนกราฟในโปรไฟล์ GitHub calendar.year เลือกปีเดียวและมีผลเหนือโหมด ยอดรวม ความต่อเนื่อง และการ์ดปฏิทินตามช่วงนี้ rolling จึงทำให้ความต่อเนื่องไม่ขาดเมื่อขึ้นปีใหม่
calendar:
mode: rolling
# year: 2025 picks one calendar year instead
timezone: Europe/Berlin
ภาษาของการ์ด
calendar.locale เป็นแท็ก BCP 47 (ค่าเริ่มต้น en-US) ป้ายการ์ดแปลแล้ว 30 ภาษา (อาหรับ ฮีบรู และเปอร์เซียวาดจากขวาไปซ้าย) locale อื่นจะใช้ป้ายภาษาอังกฤษ ตัวเลข วันที่ เดือน วันในสัปดาห์ และระยะเวลาจัดรูปแบบด้วย Intl ตาม locale ที่คุณตั้งเสมอ
อังกฤษ
calendar:
locale: en
รัสเซีย
calendar:
locale: ru
เยอรมัน
calendar:
locale: de
สเปน
calendar:
locale: es
ฝรั่งเศส
calendar:
locale: fr
โปรตุเกส
calendar:
locale: pt
ญี่ปุ่น
calendar:
locale: ja
จีน
calendar:
locale: zh
คู่มืดและสว่าง
เมื่อใช้ธีมอัตโนมัติแบบเนทีฟ SVG ทุกไฟล์จะสลับระหว่างสว่างและมืดผ่าน prefers-color-scheme อยู่แล้ว dark_mode_pair: true จะเขียนสองไฟล์ต่อการ์ดแทน เช่น streak-light.svg และ streak-dark.svg สำหรับอิลิเมนต์ <picture> ใช้กับธีมอัตโนมัติแบบเนทีฟเท่านั้น ธีมสำเร็จรูปหรือธีมที่กำหนดเองจะเขียนหนึ่งไฟล์ต่อการ์ด
theme:
mode: auto
native: true
dark_mode_pair: true
<picture>
<source media="(prefers-color-scheme: dark)" srcset="profile-graphics/streak-dark.svg" />
<img alt="Streak" src="profile-graphics/streak-light.svg" />
</picture>
แดชบอร์ด
output.layout: dashboard วางการ์ดทุกใบจาก charts ไว้ในภาพเดียว dashboard.svg (หรือ PNG หรือ WebP) แทนหนึ่งไฟล์ต่อการ์ด output.columns กำหนดจำนวนการ์ดต่อแถว 1 ถึง 4 (ค่าเริ่มต้น 2)
charts: [streak, summary, langs, calendar]
output:
layout: dashboard
columns: 2
กรอบและหัวข้อ
svg.frame กำหนดสิ่งที่ล้อมรอบการ์ดแต่ละใบ frame_radius ทำมุมโค้ง (0 ถึง 40 ค่าเริ่มต้น 8)
เส้นขอบ
ค่าเริ่มต้น: เส้นขอบบางสีเดียวกับช่องปฏิทินที่ว่าง
svg:
frame: border
frame_radius: 8
หน้าต่าง
แถบหน้าต่างพร้อมไฟสัญญาณและหัวข้อกลางแบบเลือกได้
svg:
frame: window
frame_title: "{user}"
ไม่มีกรอบ
มีเพียงพื้นหลัง สำหรับการ์ดที่อยู่ในเลย์เอาต์ของคุณเอง
svg:
frame: none
frame_title เพิ่มหัวข้อเหนือการ์ด (สูงสุด 120 ตัวอักษร) ตัวแทนเหล่านี้เติมจากสถิติของคุณ โดยตัวเลขใช้ locale ของปฏิทิน:
| ตัวแทน | ค่า |
|---|---|
{user}
| ชื่อผู้ใช้ |
{name}
| ชื่อที่แสดง หรือชื่อผู้ใช้ถ้าไม่มี |
{year}
| ปีของช่วงปฏิทิน |
{total}
| คอนทริบิวชันในช่วงเวลา |
{active_days}
| วันที่มีคอนทริบิวชันอย่างน้อยหนึ่งครั้ง |
{streak}
| ความต่อเนื่องปัจจุบันเป็นวัน |
{longest_streak}
| ความต่อเนื่องที่ยาวที่สุดเป็นวัน |
{best_day}
| คอนทริบิวชันมากที่สุดในวันเดียว |
{best_date}
| วันที่ของวันนั้น |
{stars}
| ดาวในรีโพของคุณ |
{commits}
| คอมมิตในช่วงเวลา |
{followers}
| ผู้ติดตาม |
{top_language}
| ภาษาที่ใช้มากที่สุด |
หัวข้อ ตัวเลข และแอนิเมชัน
svg.hide_title: true ซ่อนหัวข้อในการ์ดทุกใบที่มีหัวข้อ สำหรับแต่ละการ์ด title แทนที่หัวข้อและ hide_title ซ่อนหัวข้อ ดูหัวข้อการ์ด
svg.number_format กำหนดวิธีที่การ์ดเขียนจำนวน: short (ค่าเริ่มต้น) ย่อตาม locale ของการ์ด เช่น 1.2K และ long เขียนเต็ม เช่น 1,247
svg.animation เพิ่มแอนิเมชันตอนเปิดให้การ์ด SVG: fade ทำให้เนื้อหาค่อยๆ ปรากฏ และ rise ยกขึ้นอีกเล็กน้อย animation_duration กำหนดความยาวเป็นวินาที (0.2 ถึง 5 ค่าเริ่มต้น 0.8) ผู้เข้าชมที่ระบบขอลดการเคลื่อนไหวจะเห็นการ์ดโดยไม่มีแอนิเมชัน และไฟล์ PNG กับ WebP ไม่ขยับเลย ค่าเริ่มต้นคือ none
svg:
hide_title: true
number_format: long
animation: rise
animation_duration: 0.8
ใช้การตั้งค่าร่วมกับ profile-snake
extends ชี้ไปยังไฟล์ YAML หรือ JSON อื่นที่สัมพันธ์กับไฟล์ปัจจุบัน ไฟล์นั้นจะถูกอ่านก่อน แล้วรวมไฟล์ปัจจุบันทับ: ส่วนที่ซ้อนกันรวมทีละคีย์ ส่วนรายการและค่าถูกแทนที่ เก็บ provider, calendar และ theme ที่ใช้ร่วมกันไว้ใน profile.yml ไฟล์เดียว แล้ว extend จากทั้ง profile-graphics.yml และ profile-snake.yml
provider:
user: octocat
calendar:
mode: rolling
timezone: Europe/Berlin
theme:
preset: tokyo-night
extends: ./profile.yml
charts: [streak, summary, langs]
คีย์ที่เครื่องมือหนึ่งไม่รู้จัก เช่น snake หรือ charts อีกเครื่องมือจะเพิกเฉย ไฟล์ขยายกันได้สูงสุด 8 ไฟล์ หากวนซ้ำหรือไฟล์หายไปจะหยุดด้วยข้อผิดพลาดของการตั้งค่า เพลย์กราวด์และเว็บคอมโพเนนต์อ่านการตั้งค่าเพียงชุดเดียวและไม่ตาม extends
การรองรับในเอดิเตอร์
เพิ่มบรรทัดนี้ไว้บนสุดของไฟล์เพื่อให้มีการเติมคำและตรวจสอบในเอดิเตอร์ที่เข้าใจ YAML language server profile-graphics init เขียนให้คุณ profile-graphics schema พิมพ์พาธของสคีมาที่มากับแพ็กเกจ
# yaml-language-server: $schema=https://unpkg.com/profile-graphics/profile-graphics.schema.json
provider:
user: octocat