starship
starship copied to clipboard
Mac Terminal will not display colors
Bug Report
Current Behavior
I have setup starship with Warp and Zsh on macOS 13.3. The prompt looks as expected in Warp but the default Mac terminal is lacking colors.
Expected Behavior
Mac Terminal should mimic the Warp terminal. I have tried enabling and disabling support for ANSI colors in Terminal.
Additional context/Screenshots
Warp:
Mac Terminal:
Possible Solution
Do I need to map the colors I am using in Warp to the ANSI colors under Terminal?
Environment
- Starship version: 1.13.1
- Shell type: zsh
- Shell version: zsh 5.9 (x86_64-apple-darwin22.0)
- Shell plugin manager: None
- Terminal emulator: Warp
- Operating system: macOS 13.3
Starship Configuration
format = """
[ \uf179 > ](bg:#9A348E)\
$username\
[](bg:#DA627D fg:#9A348E)\
$directory\
[](fg:#DA627D bg:#FCA17D)\
$git_branch\
$git_status\
[](fg:#FCA17D bg:#86BBD8)\
$java\
$nodejs\
[](fg:#86BBD8 bg:#33658A)\
$time\
[ ](fg:#33658A)\
"""
# Disable the blank line at the start of the prompt
# add_newline = false
# You can also replace your username with a neat symbol like or disable this
# and use the os module below
[username]
show_always = true
style_user = "bg:#9A348E"
style_root = "bg:#9A348E"
format = '[$user ]($style)'
disabled = false
[directory]
style = "bg:#DA627D"
format = "[ $path ]($style)"
truncation_length = 3
truncation_symbol = "…/"
# Here is how you can shorten some long paths by text replacement
# similar to mapped_locations in Oh My Posh:
[directory.substitutions]
"Documents" = " "
"Downloads" = " "
"Music" = " "
"Pictures" = " "
[c]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[git_branch]
symbol = ""
style = "bg:#FCA17D"
format = '[ $symbol $branch ]($style)'
[git_status]
style = "bg:#FCA17D"
format = '[$all_status$ahead_behind ]($style)'
[java]
symbol = " "
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[nodejs]
symbol = ""
style = "bg:#86BBD8"
format = '[ $symbol ($version) ]($style)'
[time]
disabled = false
time_format = "%R" # Hour:Minute Format
style = "bg:#33658A"
format = '[ ♥ $time ]($style)'
I believe this is a limitation of the default terminal app, I am not sure if there is much we can do to fix this.
To elaborate, the issue is that Terminal.app does not support true color (#9A348E
). The named colors (yellow
) and short color codes (3
) should work. The one thing starship could do is use a close simple color instead if the terminal does not support truecolor.
If starship could do that out of the box that would be fantastic (not holding my breath for it). This will definitely make it but more compatible with default Terminal. I use Warp but every now and then you end up firing the terminal or a process does it.
One workaround for now is to define two palettes
, use the defined color names, and switch between a true color and regular palette via starship config palette palette_name
on shell startup based on the value of $TERM_PROGRAM
.
For reference, here is the code used by tmux
to quantize #RRGGBB
color definition to 8-bit ANSI codes: https://github.com/tmux/tmux/blob/109d2bda1a7b06948e35b7e08c159e71ebc988fb/colour.c#L45-L88
In the mean time, I created a quick Python script to convert 24-bits hexadecimal notations to 8-bits ANSI code: https://github.com/kdeldycke/dotfiles/blob/main/starship-ansi-colors.py