Skip to content

Terminal color support across dz display surfaces #49

@djdarcy

Description

@djdarcy

Summary

Add terminal color support across dz display surfaces (dz list, dz tree, dz info, dz kit list, dz kit status, stderr warnings). Goal: faster at-a-glance scanning by giving distinguishing visual weight to platform markers, virtual-kit annotations, collision/alias markers, and warning routing.

This issue is the design + implementation surface; it should probably go through a /dev-workflow-process first since color decisions are cross-cutting and hard to retract once shipped.

Motivation

Observed in dz kit list dazzletools (v0.7.28): the platform column shows windows mixed with cross-platform. Without color, the eye has to read every cell to find platform-specific tools. With distinct colors, scanning is near-instant.

Same pattern applies across the display surface area:

  • dz list (sectioned, v0.7.28) — section headers, virtual-kit annotations, [+] markers
  • dz tree — virtual-kit branches, deprecated/relocated entries (Phase 5)
  • dz info — runtime type, platform, alias provenance banners
  • Warnings + errors on stderr — visually distinct from stdout

Design considerations

Library choice

Option Pro Con
rich Modern, capable, broad ecosystem Heavy dependency for a CLI tool
colorama Mid-weight, Windows-friendly Older API, mostly initialization helpers
Raw ANSI escapes Minimal, no deps Older cmd.exe doesn't render without help; Windows Terminal handles it natively

Lean: raw ANSI + lazy colorama init for older Windows hosts. Keeps the dependency surface small while supporting all common platforms. If the project ever wants tables/spinners/progress bars, rich becomes more attractive — but that's not what color alone needs.

Honoring the user

  • NO_COLOR env var (no-color.org): when set (any value), all output is plain. Industry convention.
  • DZ_COLOR=auto|always|never project env var (or color config key) for explicit override.
  • isatty() gating: by default, color only when stdout/stderr is a terminal. Piped output stays clean.
  • Codepage safety: per project CLAUDE.md, no Unicode characters in the color sequences themselves — pure ASCII text + ANSI escape codes only. Modern terminals handle ANSI; old cmd.exe needs colorama.init() lazy-loaded.

Accessibility

  • Color-blind safe palette (avoid red/green-only distinctions for critical info)
  • Color is auxiliary, not primary — meaning must be conveyed by text too (bold + color, not just color)
  • Test against the most common deuteranopia/protanopia simulations

Proposed taxonomy (starter)

Element Style Rationale
Section headers (canonical kits) bold Structural hierarchy
Virtual-kit headers bold + cyan Distinct from canonical
(virtual kit '...') annotation dim De-emphasized metadata
Platform: windows yellow Platform-specific (caution color, attention-getting)
Platform: cross-platform green "Universally usable"
Platform: linux, macos yellow Platform-specific (consistent with windows)
Collision marker [*] red Caution, demands attention
Alias marker [+] cyan Informational link
Provenance banner ((resolved via ...)) dim De-emphasized metadata
Stderr warnings yellow Conventional
Errors red Conventional

Acceptance criteria

  • dz display surfaces honor NO_COLOR env var (no color when set)
  • DZ_COLOR=always forces color even when piped (for deliberate logging)
  • DZ_COLOR=never suppresses color even on a TTY
  • Default behavior: color only when output is a TTY
  • Color applied consistently: same role gets same color across surfaces
  • Codepage 437/1252 / pure ASCII compliance — no Unicode chars in escape sequences
  • Color taxonomy documented (in code + user docs)
  • Tests for the color-emit logic (mock TTY, NO_COLOR, DZ_COLOR overrides)
  • Manual visual review across: Windows Terminal, cmd.exe (legacy), PowerShell, bash-on-WSL, real Linux terminal

Phasing suggestion

This should not be a single mega-PR. Suggested commit progression:

  1. Library bootstrap commit: pick library/approach (raw ANSI + colorama recommended), wire NO_COLOR + DZ_COLOR + isatty() gating into a small colors.py helper module. No display changes yet.
  2. Stderr warnings + errors: first user-visible application, low blast radius.
  3. Section headers + virtual-kit annotations: structural visual cues.
  4. Platform markers + collision/alias markers: high-value scanning aid.
  5. Provenance banners + dim metadata: polish.

Each commit ships independently and the tester checklist verifies the relevant surface.

References

  • Reported via /obsidian after v0.7.28 push: private/claude/notes/cli/2026-04-28__17-13-35__both_dz-kit-list-formatting-parity-and-color.md
  • Related: drill-in column parity (filed separately, smaller scope)
  • Phase 5 graduation may add new render needs (deprecation banners) — color taxonomy should leave room
  • Industry convention: no-color.org, colorama, rich

Metadata

Metadata

Assignees

No one assigned

    Labels

    architectureStructural and design decisionsenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions