graph-colorize
Color-code the Obsidian graph view by rewriting `.obsidian/graph.json` colorGroups. Use this skill when the user says "color my graph", "color code obsidian", "colorize the graph", "color the graph by tag", "color by category", "highlight visibility in graph", "make the graph colorful", "distinguish tags in graph", or wants nodes in Obsidian's graph view tinted by tag, folder, or visibility. Generates a `colorGroups` array from the vault's actual tags/categories and merges it into the existing graph.json without clobbering other graph settings. Always backs up first.
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o graph-colorize.zip https://jpskill.com/download/22827.zip && unzip -o graph-colorize.zip && rm graph-colorize.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/22827.zip -OutFile "$d\graph-colorize.zip"; Expand-Archive "$d\graph-colorize.zip" -DestinationPath $d -Force; ri "$d\graph-colorize.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
graph-colorize.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
graph-colorizeフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
[スキル名] graph-colorize
Graph Colorize — Obsidianグラフビューを色分けする
Obsidianのグラフビューで、タグ、フォルダー、または可視性によってノードに色を付けるために、$OBSIDIAN_VAULT_PATH/.obsidian/graph.jsonを書き換えます。
Obsidianはグラフ設定を<vault>/.obsidian/graph.jsonに保存します。colorGroups配列は{query, color}ペアのリストです。ノードごとに最初に一致したクエリが適用されます。クエリはObsidianの検索構文を使用します: tag:#foo、path:"concepts"、file:fooなど。色は{"a": 1, "rgb": <packed-int>}で、intは(R << 16) | (G << 8) | Bです。
開始する前に
- 設定の解決 —
llm-wiki/SKILL.mdのConfig Resolution Protocolに従ってください(CWDを遡って.env→~/.obsidian-wiki/config→ プロンプト設定)。これによりOBSIDIAN_VAULT_PATHが得られます。 $OBSIDIAN_VAULT_PATH/.obsidian/が存在することを確認してください。存在しない場合、そのVaultはObsidianで一度も開かれていません。ユーザーにObsidianで一度Vaultを開いてから再実行するように伝えてください。- Obsidianが開いている可能性が高い場合はユーザーに警告してください: Obsidianは終了時に
graph.jsonを上書きします。ユーザーにまずVaultを閉じるか、リロード(Cmd/Ctrl+R)する準備をして、リロードするまでグラフ設定を触らないように伝えてください。
ステップ1: モードを選択する
ユーザーの表現からモードを推測します。曖昧な場合は、デフォルトでby-tagとします。
| ユーザーの意図 | モード |
|---|---|
| 「タグで色分け」「グラフを色分け」「カラフルにする」(デフォルト) | by-tag |
| 「フォルダーで色分け」「カテゴリで色分け」「ディレクトリで色分け」 | by-category |
| 「可視性をハイライト」「グラフに内部/PIIを表示」「可視性の色」 | by-visibility |
ユーザーが明示的なマッピングを提供(tag:#foo = red、またはJSONブロブ) |
custom |
| 「タグと可視性を組み合わせる」/「両方」 | combined (可視性が優先され、次にタグ) |
ステップ2: colorGroups配列を構築する
パレット(10種類の、色覚異常に配慮した色)
順番に使用します。グループ数が色数より多い場合は、サイクルさせて、2回目のパスで明るさを約20%分割して明度シフトを追加します。または、10色に制限して、残りのタグが「その他」の色を共有することをユーザーに伝えます。
| # | Hex | rgb (packed int) | 役割 |
|---|---|---|---|
| 0 | #4E79A7 |
5142951 |
青 |
| 1 | #F28E2B |
15896107 |
オレンジ |
| 2 | #E15759 |
14767961 |
赤 |
| 3 | #76B7B2 |
7780786 |
ティール |
| 4 | #59A14F |
5873999 |
緑 |
| 5 | #EDC948 |
15583048 |
黄色 |
| 6 | #B07AA1 |
11565217 |
紫 |
| 7 | #FF9DA7 |
16751527 |
ピンク |
| 8 | #9C755F |
10253663 |
茶色 |
| 9 | #BAB0AC |
12234924 |
灰色 |
すべての色は{"a": 1, "rgb": <int>}としてラップされます。
モード: by-tag
$VAULT_PATH/**/*.mdをグロブし、_archives/、_raw/、.obsidian/、node_modules/、index.md、log.md、_insights.mdを除外します。- 各ページからフロントマターの
tagsを解析します。タグごとの使用回数をカウントします。 - *`visibility/
タグを頻度リストから除外します** — これらは予約済みのシステムタグであり、by-visibilityまたはcombined`モードでのみ処理されます。 - 使用回数が多い上位10個のタグを取得します。ユニークなタグが10個未満の場合は、すべて使用します。
- インデックス
iの各タグTについて、{"query": "tag:#T", "color": palette[i]}を出力します。 - オプションで、タグ付けされていないページのための最終的なキャッチオールエントリを最後に追加します:
{"query": "-[\"tag\":]", "color": palette[9]}— カラー9がすでに実際のタグによって使用されている場合はスキップします。
モード: by-category
この固定順序で7つのVaultトップレベルフォルダーを使用し、実行間で色が安定するようにします:
| フォルダー | 色のインデックス |
|---|---|
concepts |
0 (青) |
entities |
1 (オレンジ) |
skills |
2 (赤) |
references |
3 (ティール) |
synthesis |
4 (緑) |
projects |
5 (黄色) |
journal |
6 (紫) |
存在するかつ少なくとも1つの.mdファイルを含むフォルダーごとに1つのエントリを出力します。各エントリは次のとおりです:
{"query": "path:\"<folder>\"", "color": {"a": 1, "rgb": <int>}}
モード: by-visibility
正確に3つのエントリをこの順序で出力します(最初の一致が優先されるため、最も制限の厳しいものが最初に来ます):
visibility/pii→#E15759(赤, rgb 14767961)visibility/internal→#F28E2B(オレンジ, rgb 15896107)visibility/public→#59A14F(緑, rgb 5873999)
{"query": "tag:#visibility/pii", "color": {"a": 1, "rgb": 14767961}}
visibility/タグのないページはObsidianのデフォルトの色のままになります — キャッチオールは追加しません。
モード: combined
まずby-visibilityのエントリを出力し、次にby-tagのエントリを出力します。リストの最初に表示されるため、競合が発生した場合は可視性が優先されます。
モード: custom
ユーザーが明示的なマッピングを提供した場合、それを文字通り尊重します。ユーザーが提供した任意の16進数(例: #FF00FF)を、int(hex_without_hash, 16)を使用してパックされた整数に変換します。それぞれを{"a": 1, "rgb": <int>}としてラップします。
ステップ3: graph.jsonにマージする(上書きしない)
-
既存の
$VAULT_PATH/.obsidian/graph.jsonを読み取ります。存在しない場合は、この最小限のデフォルトから開始します:{ "collapse-filter": true, "search": "", "showTags": false, "showAttachments": false, "hideUnresolved": false, "showOrphans": true, "collapse-color-groups": false, "colorGroups": [], "collapse-display": true, "showArrow": false, "textFadeMultiplier": 0, "nodeSizeMultiplier": 1, "lineSizeMultiplier": 1, "collapse-forces": true, "centerStrength": 0.518713248970312, "repelStrength": 10, "linkStrength": 1, "linkDistance": 250, "scale": 1, "close": true } -
まずバックアップを作成します: 書き込む前に、既存のファイルを
.obsidian/graph.json.backup-<YYYYMMDD-HHMM>にコピーします。同じ分のバックアップが存在する場合は、それを再利用します — 重複を積み重ねないでください。 -
colorGroupsフィールドのみを新しい配列に置き換えます。他のすべてのフィールドはそのままにしておきます。これにより、ユーザーのズーム、物理設定、フィルター、検索、表示設定が保持されます。 -
ファイルを元のJSONスタイル(通常はコンパクトな単一行または2スペースインデント — 既存のものを保持)で書き戻します。
ステップ4: レポートとログ
次のような要約を出力します:
グラフが色分けされました → .obsidian/graph.json
モード: by-tag
グループ: 7色の割り当て
パレット: 青、オレンジ、赤、ティール、緑、黄色、紫
バックアップ: .obsidia 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Graph Colorize — Color-code the Obsidian Graph View
You are rewriting $OBSIDIAN_VAULT_PATH/.obsidian/graph.json so Obsidian's graph view tints nodes by tag, folder, or visibility.
Obsidian stores graph settings in <vault>/.obsidian/graph.json. The colorGroups array is a list of {query, color} pairs; the first matching query wins per node. Queries use Obsidian's search syntax: tag:#foo, path:"concepts", file:foo, etc. Color is {"a": 1, "rgb": <packed-int>} where the int is (R << 16) | (G << 8) | B.
Before You Start
- Resolve config — follow the Config Resolution Protocol in
llm-wiki/SKILL.md(walk up CWD for.env→~/.obsidian-wiki/config→ prompt setup). This givesOBSIDIAN_VAULT_PATH. - Confirm
$OBSIDIAN_VAULT_PATH/.obsidian/exists. If it doesn't, the vault has never been opened in Obsidian — tell the user to open the vault once in Obsidian, then re-run. - Warn the user if Obsidian is likely open: Obsidian overwrites
graph.jsonon close. Tell them to close the vault first, or be ready to reload (Cmd/Ctrl+R) and not touch the graph settings until they reload.
Step 1: Pick a Mode
Infer the mode from the user's phrasing. If ambiguous, default to by-tag.
| User intent | Mode |
|---|---|
| "color by tag", "color my graph", "make it colorful" (default) | by-tag |
| "color by folder", "color by category", "color by directory" | by-category |
| "highlight visibility", "show internal/pii in graph", "visibility colors" | by-visibility |
User provides explicit mapping (tag:#foo = red, or JSON blob) |
custom |
| "combine tag and visibility" / "both" | combined (visibility first, then tag) |
Step 2: Build the colorGroups Array
Palette (10 distinct, colorblind-friendly colors)
Use in order. If more groups than colors, cycle and add a lightness shift by dividing brightness ~20% via a second pass — or just cap at 10 and tell the user the remaining tags share the "other" color.
| # | Hex | rgb (packed int) | Role |
|---|---|---|---|
| 0 | #4E79A7 |
5142951 |
blue |
| 1 | #F28E2B |
15896107 |
orange |
| 2 | #E15759 |
14767961 |
red |
| 3 | #76B7B2 |
7780786 |
teal |
| 4 | #59A14F |
5873999 |
green |
| 5 | #EDC948 |
15583048 |
yellow |
| 6 | #B07AA1 |
11565217 |
purple |
| 7 | #FF9DA7 |
16751527 |
pink |
| 8 | #9C755F |
10253663 |
brown |
| 9 | #BAB0AC |
12234924 |
gray |
Every color is wrapped as {"a": 1, "rgb": <int>}.
Mode: by-tag
- Glob
$VAULT_PATH/**/*.mdexcluding_archives/,_raw/,.obsidian/,node_modules/,index.md,log.md,_insights.md. - Parse frontmatter
tagsfrom each page. Count usage per tag. - *Drop `visibility/
tags** from the frequency list — they are reserved system tags, handled only inby-visibilityorcombined` mode. - Take the top 10 tags by usage. If there are fewer than 10 unique tags, use all of them.
- For each tag
Tat indexi: emit{"query": "tag:#T", "color": palette[i]}. - Optionally, append a final catch-all entry for untagged pages at the end:
{"query": "-[\"tag\":]", "color": palette[9]}— skip if color slot 9 is already taken by a real tag.
Mode: by-category
Use the seven vault top-level folders in this fixed order so colors are stable across runs:
| Folder | Color index |
|---|---|
concepts |
0 (blue) |
entities |
1 (orange) |
skills |
2 (red) |
references |
3 (teal) |
synthesis |
4 (green) |
projects |
5 (yellow) |
journal |
6 (purple) |
Emit one entry per folder that exists AND contains at least one .md file. Each entry is:
{"query": "path:\"<folder>\"", "color": {"a": 1, "rgb": <int>}}
Mode: by-visibility
Emit exactly three entries, in this order (first-match wins, so most restrictive comes first):
visibility/pii→#E15759(red, rgb 14767961)visibility/internal→#F28E2B(orange, rgb 15896107)visibility/public→#59A14F(green, rgb 5873999)
{"query": "tag:#visibility/pii", "color": {"a": 1, "rgb": 14767961}}
Pages with no visibility/ tag remain Obsidian's default color — do not add a catch-all.
Mode: combined
Emit by-visibility entries first, then by-tag entries. Visibility wins on conflict because it appears first in the list.
Mode: custom
If the user gave explicit mappings, honor them literally. Convert any hex they give (e.g. #FF00FF) to packed int using int(hex_without_hash, 16). Wrap each as {"a": 1, "rgb": <int>}.
Step 3: Merge into graph.json (Do Not Clobber)
-
Read the existing
$VAULT_PATH/.obsidian/graph.json. If it doesn't exist, start from this minimal default:{ "collapse-filter": true, "search": "", "showTags": false, "showAttachments": false, "hideUnresolved": false, "showOrphans": true, "collapse-color-groups": false, "colorGroups": [], "collapse-display": true, "showArrow": false, "textFadeMultiplier": 0, "nodeSizeMultiplier": 1, "lineSizeMultiplier": 1, "collapse-forces": true, "centerStrength": 0.518713248970312, "repelStrength": 10, "linkStrength": 1, "linkDistance": 250, "scale": 1, "close": true } -
Back up first: copy the existing file to
.obsidian/graph.json.backup-<YYYYMMDD-HHMM>before writing. If a backup from the same minute exists, reuse it — don't pile up duplicates. -
Replace only the
colorGroupsfield with your new array. Leave every other field untouched. This preserves the user's zoom, physics, filter, search, and display preferences. -
Write the file back with the same JSON style as the original (usually compact single-line or 2-space indent — preserve what's there).
Step 4: Report and Log
Print a summary like:
Graph colorized → .obsidian/graph.json
Mode: by-tag
Groups: 7 color assignments
Palette: blue, orange, red, teal, green, yellow, purple
Backup: .obsidian/graph.json.backup-20260424-1432
Reload Obsidian (Cmd/Ctrl+R) to see the new colors.
If Obsidian is currently open, close it first OR reload immediately — Obsidian
overwrites graph.json on close and can erase these changes.
Append to $VAULT_PATH/log.md:
- [TIMESTAMP] GRAPH_COLORIZE mode=<mode> groups=<N> backup=graph.json.backup-<stamp>
Edge Cases
- No tags in vault in
by-tagmode → fall back toby-categoryand tell the user. - User wants to undo → restore from the latest
graph.json.backup-*and note that inlog.md. - User wants to clear all color groups → set
colorGroups: [], back up, log asGRAPH_COLORIZE mode=clear. .obsidian/missing → the vault hasn't been opened in Obsidian yet. Tell the user to open it once, then re-run. Don't create.obsidian/yourself — Obsidian populates many files there on first open.- Query syntax gotchas: folder paths with spaces need quoting (
path:"my folder"); tags with nested slashes work literally (tag:#visibility/internal); don't URL-encode. - Obsidian open during edit: surface the risk — Obsidian reads graph.json at startup and rewrites it on close. If the user is editing live, tell them to close Obsidian first or run the reload (Cmd/Ctrl+R) immediately and avoid opening graph settings before they do.
Notes
- This is a pure config edit — no page content changes, no frontmatter writes.
- Re-running is safe: each run creates a new backup, only
colorGroupsis rewritten. - If the user has manually curated color groups they want to keep, offer
combinedmode or ask before overwriting. - The palette here matches
wiki-export'sgraph.htmlcommunity colors, so the Obsidian graph and the exported visualization look consistent.