Skip to content

Commit 7bb5570

Browse files
committed
docs(AGENTS.md): Add CLI Color Semantics guide (Revision 1)
Document the semantic color system for CLI output: - Hierarchy-based color assignment (L0-L3 levels) - Status-based color overrides - Design principles from jq, ripgrep, mise/just - Available Colors class methods - Key rule: never use same color for adjacent hierarchy levels
1 parent 4a86aeb commit 7bb5570

File tree

1 file changed

+62
-0
lines changed

1 file changed

+62
-0
lines changed

AGENTS.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,65 @@ $ uv run pytest --cov
194194
- **QA every edit**: Run formatting and tests before committing
195195
- **Minimum Python**: 3.10+ (per pyproject.toml)
196196
- **Minimum tmux**: 3.2+ (as per README)
197+
198+
## CLI Color Semantics (Revision 1, 2026-01-04)
199+
200+
The CLI uses semantic colors via the `Colors` class in `src/tmuxp/cli/_colors.py`. Colors are chosen based on **hierarchy level** and **semantic meaning**, not just data type.
201+
202+
### Design Principles
203+
204+
1. **Structural hierarchy**: Headers > Items > Details
205+
2. **Semantic meaning**: What IS this element?
206+
3. **Visual weight**: What should draw the eye first?
207+
4. **Depth separation**: Parent elements should visually contain children
208+
209+
Inspired by patterns from **jq** (object keys vs values), **ripgrep** (path/line/match distinction), and **mise/just** (semantic method names).
210+
211+
### Hierarchy-Based Colors
212+
213+
| Level | Element Type | Method | Color | Examples |
214+
|-------|--------------|--------|-------|----------|
215+
| **L0** | Section headers | `heading()` | Cyan + bold | "Local workspaces:", "Global workspaces:" |
216+
| **L1** | Primary content | `highlight()` | Magenta + bold | Workspace names (braintree, .tmuxp) |
217+
| **L2** | Supplementary info | `info()` | Cyan | Paths (~/.tmuxp, ~/project/.tmuxp.yaml) |
218+
| **L3** | Metadata/labels | `muted()` | Blue (dim) | Source labels (Legacy:, XDG default:) |
219+
220+
### Status-Based Colors (Override hierarchy when applicable)
221+
222+
| Status | Method | Color | Examples |
223+
|--------|--------|-------|----------|
224+
| Success/Active | `success()` | Green | "active", "18 workspaces" |
225+
| Warning | `warning()` | Yellow | Deprecation notices |
226+
| Error | `error()` | Red | Error messages |
227+
228+
### Example Output
229+
230+
```
231+
Local workspaces: ← heading() cyan+bold
232+
.tmuxp ~/work/python/tmuxp/.tmuxp.yaml ← highlight() + info()
233+
234+
Global workspaces (~/.tmuxp): ← heading() + info()
235+
braintree ← highlight()
236+
cihai ← highlight()
237+
238+
Global workspace directories: ← heading()
239+
Legacy: ~/.tmuxp (18 workspaces, active) ← muted() + info() + success()
240+
XDG default: ~/.config/tmuxp (not found) ← muted() + info() + muted()
241+
```
242+
243+
### Available Methods
244+
245+
```python
246+
colors = Colors()
247+
colors.heading("Section:") # Cyan + bold (section headers)
248+
colors.highlight("item") # Magenta + bold (primary content)
249+
colors.info("/path/to/file") # Cyan (paths, supplementary info)
250+
colors.muted("label:") # Blue dim (metadata, labels)
251+
colors.success("ok") # Green (success states)
252+
colors.warning("caution") # Yellow (warnings)
253+
colors.error("failed") # Red (errors)
254+
```
255+
256+
### Key Rule
257+
258+
**Never use the same color for adjacent hierarchy levels.** If headers and items are both blue, they blend together. Each level must be visually distinct.

0 commit comments

Comments
 (0)