True colour background and foreground colours don't match for same RGB values
Bug report
I am trying to render a custom status line for tmux that includes two special characters with opposite colors for their background and foreground. The colours do not match.
- iTerm2 version: 3.4.19
- OS version: macOS Ventura 13.2
- Attach
~/Library/Preferences/com.googlecode.iterm2.plist
here (drag-drop from finder into this window) com.googlecode.iterm2.plist - Attach a screen capture video if it would make the reproduction steps clearer.
The status bar theme is https://github.com/catppuccin/tmux
Here is a simplified test case:
#!/bin/bash
setForegroundColor()
{
printf '\x1b[38;2;%s;%s;%sm' $1 $2 $3
}
setBackgroundColor()
{
printf '\x1b[48;2;%s;%s;%sm' $1 $2 $3
}
resetOutput()
{
echo -en "\x1b[0m\n"
}
setForegroundColor 166 209 137
setBackgroundColor 48 52 70
echo -n
setForegroundColor 48 52 70
setBackgroundColor 166 209 137
echo -n
resetOutput
Here is a screenshot of the printed characters:
As you can see, the greens do not match. This was tested inside and outside tmux.
Why would the colours not match?
Edited by Jamie Macdonald