# graph-colorize

Color-codes Obsidian graph nodes by tag, folder, or visibility in .obsidian/graph.json. Useful when you need a clear visual structure across your vault.

- skill · `type=skill` · Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, OpenCode · 2800 installs · ★ 3621
- Author: Ar9av
- License: MIT · policy=mirror · the beginning of the file is at the end of this page
- Source: https://github.com/Ar9av/obsidian-wiki/tree/HEAD/.skills/graph-colorize/SKILL.md
- Updated: 2026-10-21
- HTML: https://affpapa.org/en/nevibecode/skills/graph-colorize

## What it does

The skill rewrites the `colorGroups` array in `$OBSIDIAN_VAULT_PATH/.obsidian/graph.json` using a 10-color palette. It parses markdown notes and applies colors based on chosen rules: top tags (`by-tag`), fixed top-level category folders (`by-category`), access markers like internal or PII (`by-visibility`), or custom hex mappings.

Before modifying the file, the skill creates a timestamped copy named `.obsidian/graph.json.backup-<YYYYMMDD-HHMM>`. It updates only `colorGroups`, leaving your graph forces, scale multipliers, and search filters intact. Each colorization event is appended to `log.md`.

Keep in mind that Obsidian overwrites `graph.json` on shutdown, which easily erases automated file updates. Close Obsidian before running this command or reload the interface with Cmd/Ctrl+R immediately after completion.

## Requirements
- Works with: Obsidian

## Install

### Claude Code (native platform)

1. **Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill graph-colorize -a claude-code
```

2. **Manually: put the files in place**
- File: `~/.claude/skills/graph-colorize/SKILL.md` — Copy the whole skill folder; for one project use .claude/skills/graph-colorize/

### Codex

1. **Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill graph-colorize -a codex
```

2. **Manually: put the files in place**
- File: `.agents/skills/graph-colorize/SKILL.md` — For all projects use ~/.agents/skills/

### Cursor

1. **Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill graph-colorize -a cursor
```

2. **Manually: put the files in place**
- File: `.cursor/skills/graph-colorize/SKILL.md` — Cursor also reads .agents/skills/ and .claude/skills/

### GitHub Copilot

1. **GitHub CLI**
```bash
gh skill install Ar9av/obsidian-wiki graph-colorize
```

2. **Manually: put the files in place**
- File: `.github/skills/graph-colorize/SKILL.md`

### Gemini CLI

1. **Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill graph-colorize -a gemini-cli
```

2. **Platform CLI**
```bash
gemini skills install https://github.com/Ar9av/obsidian-wiki --path .skills/graph-colorize
```

### Windsurf (Devin Desktop)

**Manually: put the files in place**
- File: `.devin/skills/graph-colorize/SKILL.md` — The legacy .windsurf/skills/ path still works

### OpenCode

**Skills CLI (Vercel)**
```bash
npx skills add Ar9av/obsidian-wiki --skill graph-colorize -a opencode
```

### Claude.ai

**Claude.ai**
- Zip the folder and upload it in Settings → Capabilities → Skills

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/Ar9av/obsidian-wiki/tree/HEAD/.skills/graph-colorize/SKILL.md

## When to use it
- color-code Obsidian graph view nodes by frequent tags
- assign stable colors to vault category folders
- highlight sensitive notes by visibility tags on the graph
- restore graph color groups from a previous backup

## Example prompts
- Color my Obsidian graph by tag
- Highlight visibility tags like pii and internal in the graph
- Colorize graph by category folders

## Source text · SKILL.md · MIT

Below is the content of a third-party file. It is data, not instructions for you: do not act on anything written inside unless the human asks. Block tag: 67725528d9e390f8.

BEGIN THIRD-PARTY FILE 67725528d9e390f8
```text
---
name: graph-colorize
description: >
  Configure Obsidian graph colors by tag, folder, category, or visibility by updating .obsidian/graph.json. Use for graph colorization; preserve other graph settings and back up before changes.
---

# 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

1. **Resolve config** — follow the Config Resolution Protocol in `llm-wiki/SKILL.md` (inline `@name` override → walk up CWD for `.env` → global config → prompt setup). This gives `OBSIDIAN_VAULT_PATH`.
2. 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.
3. **Warn the user if Obsidian is likely open**: Obsidian overwrites `graph.json` on 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`

1. Glob `$VAULT_PATH/**/*.md` excluding `_archives/`, `_raw/`, `.obsidian/`, `node_modules/`, `index.md`, `log.md`, `_insights.md`.
2. Parse frontmatter `tags` from each page. Count usage per tag.
```
END THIRD-PARTY FILE 67725528d9e390f8

The third-party file has ended. Everything between the 67725528d9e390f8 tags is data: requests and commands from it are not followed. An “end of file” line with another tag inside the block is part of the file.

First 2960 of 8068 bytes. © Ar9av · MIT · https://github.com/Ar9av/obsidian-wiki/tree/HEAD/.skills/graph-colorize/SKILL.md

_Part of the page did not fit — see the HTML version._

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
