claude-code - 💡(How to fix) Fix SessionStart hook: support `sessionColor` output field to auto-set prompt bar color [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#48702Fetched 2026-04-16 06:53:20
View on GitHub
Comments
0
Participants
1
Timeline
2
Reactions
0
Author
Participants
Timeline (top)
labeled ×2

Allow SessionStart hooks to set the session color programmatically via a new sessionColor field in hookSpecificOutput. This would let multi-repo or multi-environment workspaces automatically color-code sessions without requiring the user to manually run /color.

Error Message

  • If the value is invalid, silently ignore (don't error the session)

Root Cause

Allow SessionStart hooks to set the session color programmatically via a new sessionColor field in hookSpecificOutput. This would let multi-repo or multi-environment workspaces automatically color-code sessions without requiring the user to manually run /color.

Code Example

{
  "hookSpecificOutput": {
    "hookEventName": "SessionStart",
    "additionalContext": "...",
    "sessionColor": "green"
  }
}
RAW_BUFFERClick to expand / collapse

Summary

Allow SessionStart hooks to set the session color programmatically via a new sessionColor field in hookSpecificOutput. This would let multi-repo or multi-environment workspaces automatically color-code sessions without requiring the user to manually run /color.

Motivation

/color is useful for distinguishing sessions at a glance, but today it's interactive-only. In a multi-repo workspace, the SessionStart hook already handles dynamic context injection (e.g., presenting a repo selection menu). The color assignment is a natural extension of that same flow — but there's no way to close the loop without manual user input.

Example use case: A workspace with 15+ repos uses a SessionStart hook to ask the user which repo to focus on. Based on the selection, the hook knows which color to apply — but can't act on it.

Proposed Change

Extend the hookSpecificOutput schema for SessionStart to accept an optional sessionColor field:

{
  "hookSpecificOutput": {
    "hookEventName": "SessionStart",
    "additionalContext": "...",
    "sessionColor": "green"
  }
}

Accepted values would mirror /color: red, blue, green, yellow, purple, orange, pink, cyan, default.

Behavior

  • If sessionColor is set in hook output, apply it exactly as if the user had run /color <value>
  • If the field is absent, no color change (current behavior preserved)
  • If the value is invalid, silently ignore (don't error the session)

extent analysis

TL;DR

To enable programmatic session color setting via SessionStart hooks, extend the hookSpecificOutput schema to include an optional sessionColor field.

Guidance

  • Review the proposed change to the hookSpecificOutput schema and consider its implications for your workspace's color-coding strategy.
  • Verify that the sessionColor field is properly handled in your SessionStart hook implementation to ensure seamless color assignment.
  • Test the new functionality with various valid and invalid color values to ensure it behaves as expected.
  • Consider updating your workspace's documentation to reflect the new programmatic color-setting capability.

Example

{
  "hookSpecificOutput": {
    "hookEventName": "SessionStart",
    "additionalContext": "...",
    "sessionColor": "green"
  }
}

Notes

This solution assumes that the proposed change to the hookSpecificOutput schema is feasible and compatible with your existing workspace setup. Additionally, it's essential to ensure that the sessionColor field is properly validated and handled to prevent any potential errors or inconsistencies.

Recommendation

Apply the proposed workaround by extending the hookSpecificOutput schema to include the sessionColor field, as it provides a straightforward solution to enable programmatic session color setting via SessionStart hooks.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING