Could we help you? Please click the banners. We are young and desperately need the money
If you use Claude Code, you've probably noticed the status line that appears at the top of each response. The default version is functional but basic—it shows minimal information without much visual appeal.
Good news: Claude Code lets you fully customize this status line. You can add useful information, apply colors, and style it however you want.
In this guide, I'll show you how to create a custom status line that's both informative and visually appealing.
A custom status line gives you:
Your status line can show anything you want:
The setup is simple:
Your script receives JSON input with context information (model, directory, etc.) and outputs formatted text with ANSI color codes.
Here's a complete example that shows time, model, user info, directory, and git status with colors:
nano ~/.claude/statusline-command.sh
#!/bin/bash
# Read JSON input from stdin
input=$(cat)
# Extract values from JSON
model_name=$(echo "$input" | jq -r '.model.display_name // "Claude"')
current_dir=$(echo "$input" | jq -r '.workspace.current_dir // ""')
output_style=$(echo "$input" | jq -r '.output_style.name // ""')
# Get current time
current_time=$(date +%H:%M:%S)
# Get username and hostname
username=$(whoami)
hostname=$(hostname -s)
# Get current directory (fallback to pwd if JSON doesn't provide it)
if [ -z "$current_dir" ]; then
current_dir=$(pwd)
fi
# Get git branch if in a git repo
git_branch=""
if git rev-parse --git-dir > /dev/null 2>&1; then
branch=$(git -c gc.autodetach=false -c core.useBuiltinFSMonitor=false branch --show-current 2>/dev/null)
if [ -n "$branch" ]; then
# Check if there are uncommitted changes
if ! git -c gc.autodetach=false diff-index --quiet HEAD -- 2>/dev/null; then
git_branch=$(printf ' \033[38;5;208m(\033[38;5;214m%s\033[38;5;208m *\033[38;5;208m)' "${branch}") # Orange with asterisk for dirty
else
git_branch=$(printf ' \033[38;5;77m(\033[38;5;83m%s\033[38;5;77m)' "${branch}") # Green for clean
fi
fi
fi
# Build output style indicator if present
style_indicator=""
if [ -n "$output_style" ] && [ "$output_style" != "default" ]; then
style_indicator=$(printf ' \033[38;5;141m[\033[38;5;147m%s\033[38;5;141m]' "${output_style}")
fi
# Build the status line with colors
printf '\033[38;5;51m⏱ %s\033[00m \033[38;5;141m│\033[00m \033[38;5;135m🤖 %s\033[00m%s \033[38;5;141m│\033[00m \033[01;32m%s@%s\033[00m:\033[01;34m%s\033[00m%s\n' \
"$current_time" \
"$model_name" \
"$style_indicator" \
"$username" \
"$hostname" \
"$current_dir" \
"$git_branch"
chmod +x ~/.claude/statusline-command.sh
Edit your settings:
nano ~/.claude/settings.json
Add this configuration:
{
"statusline-command": "~/.claude/statusline-command.sh"
}
claude
You'll see your colorful status line with all the information!
The script uses ANSI escape codes for colors:
\033[38;5;51m - Cyan for time\033[38;5;135m - Magenta for model name\033[01;32m - Bold green for username/hostname\033[01;34m - Bold blue for directory\033[38;5;77m - Green for clean git branch\033[38;5;208m - Orange for uncommitted changes\033[00m - Reset to defaultImportant: Use printf instead of echo to properly render the colors.
Here's the best part: custom status lines don't consume tokens or count toward your usage limits.
The script runs locally on your machine before Claude generates a response. You can make your status line as detailed as you want without worrying about costs.
The example above is just a starting point. You can customize your status line to show:
printf '%s @ %s\n' "$model_name" "$current_dir"
Replace emojis, change colors, or use different separators—it's completely up to you.
Customizing your Claude Code status line is easy and powerful. With a simple shell script, you get:
Start with the example above, then modify it to show the information that matters most to your workflow. Your Claude Code experience will be more productive and visually satisfying.