圖示元件——.astro 場景的唯一寫法
Icon src/components/ui/Icon.astro:2 樣品
還沒有樣品——動到這個零件時順手在 src/design-samples/Icon.astro 補一份(照同資料夾其他樣品的寫法:最少、最多、最長字、選中、停用)。
規則(檔頭原文)
- 何時用
- .astro 裡表達「一個動作/狀態」的圖示;說「一個東西」的具體遊戲事物(地圖、生物、血月)留 emoji,判準與例外見下方〈怎麼用〉。
- 怎樣算合格
- 預設粗線,雙色只給主角位置(導覽分頁、入口卡標題),同一排不混;顏色只用 currentColor 或成功/失敗色; 旁邊有字就不傳 label(預設 aria-hidden),只有圖示沒有字才傳。
- owner 說過
- 2026-11-14 看真實頁面樣張選定 Phosphor 粗線+雙色混用(330 批 3-4)。
檔頭全文
圖示元件——.astro 場景的唯一寫法(JS 場景用 src/lib/icon-dom.ts)。
何時用:.astro 裡表達「一個動作/狀態」的圖示;說「一個東西」的具體遊戲事物(地圖、生物、血月)留 emoji,判準與例外見下方〈怎麼用〉。
怎樣算合格:預設粗線,雙色只給主角位置(導覽分頁、入口卡標題),同一排不混;顏色只用 currentColor 或成功/失敗色;
旁邊有字就不傳 label(預設 aria-hidden),只有圖示沒有字才傳。
owner 說過:2026-11-14 看真實頁面樣張選定 Phosphor 粗線+雙色混用(330 批 3-4)。
═══ 330 批 3-4:Phosphor 粗線+雙色混用(owner 2026-11-14 看真實頁面樣張選定)═══
· 預設=粗線(bold):清單、按鈕、標籤、提示、表格裡的小圖示——跟著文字走的地方。
· `duo`=雙色(duotone):**主角位置**才用,判準=「這顆圖示本身就是一個入口的臉」:
① 導覽分頁(遊戲頁頭六格、手機貼底列)
② 入口卡/功能卡的標題圖示(一張卡一顆、比文字大)
同一排裡要嘛全雙色、要嘛全粗線,不混;一頁的雙色圖示是「找入口」的訊號,滿地都是就失效。
· 雙色的淡色層顏色=`--ic-duo`,預設跟基地主題色走(global.css `.ic-duo`);深色底或選中狀態要換色就在那個位置設 `--ic-duo`。
· 來源與對名表在 `scripts/gen-icons.mjs`(站內鍵名沿用 Lucide 時代,不用改呼叫端)。
尺寸預設 1.15em(定義在 global.css 的 .ic),跟著所在文字的字級縮放,多數情況不必指定 size。
無障礙:圖示旁一律有文字說明 → 預設 aria-hidden,避免螢幕閱讀器唸出「鑰匙 管理員登入」。只有圖示、沒有文字時才傳 label。
═══ 怎麼用(2026-07-26 定,2026-11-15 自 docs/design/foundations-visual.md §1-4 搬來=本檔是圖示規則唯一正本)═══
· 全站唯一寫法:.astro 用 <Icon>、JS 用 src/lib/icon-dom.ts(安全用法寫在那支檔頭);不貼 emoji 當 UI 圖示。
· 判準:這個圖示在說「一個動作/狀態」→ 用 <Icon>;在說「一個東西」(地圖、生物、血月這種具體遊戲事物)→ 留 emoji。
同一個 emoji 在不同位置性質不同,逐處判斷、禁止全域取代(🔥 在熱力圖=最熱門→換、在食物表=燒烤分類→留)。
· 配色:顏色要嘛編碼資訊、要嘛標示身分,純為好看不上色。成功/失敗用 --c-ok-ink/--c-bad-ink;其餘一律 currentColor
(按鈕與導覽已有彩色底,圖示再上色=彩色底上的彩色線)。例外只有雙色層讀 --ic-duo(見上)。
顏色能不能用要連「面積」一起問:主題色當填色底配墨色圖示 8.92:1,當線條色只有 1.94:1。
· 對齊:SVG 不跟文字基線走,容器負責——.icrow(flex+gap 8px+wrap,wrap 不可省)/.icrow--top(長文字對第一行)/
.inpwrap(輸入框左側圖示,placeholder 放不了 SVG 時用)。gap 取代原本 emoji 後的空白,換圖示時把字串裡的空白刪掉。
元件內要調 .ic 尺寸必須用 :global()(Astro scoped 樣式不跨元件邊界)。
· 殘留檢查:scripts/site-scan.sh ③區比對已審視過的 emoji 白名單,門檻 0。用在哪
用在 90 頁:直接 31 頁、經別的零件 59 頁
直接
- /w3z
- /w3z/local
- /w3z/settings
- /w3z/tools
- /account
- /admin/blueprints
- /admin/dc/access
- /admin/dc/announce
- /admin/dc/gta6-topics
- /admin/dc
- /admin/dc/members
- /admin/dc/survey
- /admin/dc/traffic
- /admin/lol-feedback
- /admin/tools
- /ark/notes/explorer-notes
- /ark/notes/island-dinos
- /ark/notes/map
- /ark/notes/server-rules
- /dc-guide
- /gta6/map
- /
- /join
- /mods/blueprint
- /pz/notes/jarvis-sorting
- /pz/notes/modern-food-lookup
- /sgs/start
- /sgs/start/install
- /sgs/war
- /sotf/notes/progress
- /syncer/login
src/components/7dtd/Dashboard.astrosrc/components/DcDiscuss.astrosrc/components/DcNav.astrosrc/components/ModDownloadCell.astrosrc/components/ModTable.astrosrc/components/Nav.astrosrc/components/admin/AdminGate.astrosrc/components/admin/AdminShell.astrosrc/components/ark/MapSteamLink.astrosrc/components/ark/MapTable.astrosrc/components/dc-guide/GuideItem.astrosrc/components/guides/BackToTop.astrosrc/components/guides/GuideHome.astrosrc/components/guides/GuideMap.astrosrc/components/guides/GuideShell.astrosrc/components/guides/GuideTreePanel.astrosrc/components/guides/RetiredNote.astrosrc/components/guides/SpoilerNote.astrosrc/components/guides/ZoneIndex.astrosrc/components/lookup/LookupShell.astrosrc/components/map/MapShell.astrosrc/components/map/MapToolsPanel.astrosrc/components/page/DocPage.astrosrc/components/search/GameSearch.astrosrc/components/sgs/SgsHero.astrosrc/components/ui/Breadcrumb.astrosrc/components/ui/CvdToggle.astrosrc/components/ui/GameBand.astrosrc/components/ui/GameHero.astrosrc/components/ui/GamePageHead.astrosrc/components/ui/GameSubNav.astrosrc/components/ui/GiveWorkbench.astrosrc/components/ui/RefCard.astrosrc/components/ui/SearchSelect.astro
經骨架或別的零件
- /404
- /w3z/connect
- /w3z/local/all
src/pages/[game]/notes/[slug].astro- /w3z/notes
src/pages/[game]/paused/[feature].astro- /about
- /ark/maps
src/pages/ark/maps/[map].astro- /ark/notes/build-planner
- /ark/notes/items
- /ark/notes/recipe
- /ark/updates
src/pages/blueprints/[id].astro- /blueprints/ai
- /blueprints/gallery
- /blueprints
- /dj
- /gta6/cards
src/pages/gta6/chapters/[ch].astrosrc/pages/gta6/chapters/[ch]/[slug].astro- /gta6/chapters
- /gta6/eggs
- /gta6/hud
- /gta6/progress
src/pages/lol/[id].astrosrc/pages/lol/augments/[...slug].astro- /lol/destiny
- /lol
src/pages/lol/items/[...slug].astrosrc/pages/lol/patch/[v].astrosrc/pages/lol/schools/[...slug].astro- /lol/team
- /p5r/calendar
src/pages/p5r/notes/coop/[id].astro- /p5r/notes/fusion
- /p5r/notes/how-to
- /sgs/codex
src/pages/sgs/learn/[slug].astro- /sgs/learn/cheatsheet
- /sgs/learn/faq
- /sgs/learn
- /sgs/learn/interface
- /sgs/learn/practice
- /sgs/news
- /sotf/notes/items
- /ul/notes/containers
- /ul/notes/creatures
- /ul/notes/items
- /ul/notes/pois
- /ul/notes/research
- /ul/notes/server-rules
- /ul/notes/skills
- /ul/notes/stations
- /ul/notes/statuses
- /ul/notes/traders
- /w3z/notes/creatures
- /w3z/notes/items
- /w3z/notes/server-rules
程式認不出來的
掃描看不到的
- markdown 文章經 remark/rehype 外掛產生的 HTML(不經 import)
- 前端 JS 當場畫出來的 HTML(字串拼接、innerHTML)——CSS 零件的類名寫在 .ts 裡的會列在「程式產生」,寫法動態組字串的看不到
- 用變數組出來的類名(例:`ui-btn--${tone}`)只算到前半