Text backgroundcolor is not respected behind imgcat images
Thanks for filing an issue! Please answer the questions below so I can help you.
- iTerm2 version: Build 3.4.3
- OS version: 11.1 (20C69) x64
- Attach com.googlecode.iterm2.plist here (drag-drop from finder into this window)
- Attach a debug log, if possible. Instructions at https://iterm2.com/debuglog
- Attach a screen capture video if it would make the reproduction steps clearer.
- Are you reporting a performance issue, excessive CPU usage, or a hang? Please attach a sample. Instructions at https://gitlab.com/gnachman/iterm2/wikis/HowToSample
- Are you reporting a crash? Please attach the crash log. Instructions at https://gitlab.com/gnachman/iterm2/wikis/crash-logs
- Are you reporting excessive memory usage? Please attach a heap analysis: https://gitlab.com/gnachman/iterm2/wikis/heapshot
PLEASE ATTACH YOUR PLIST FILE FOR BUG REPORTS! Seriously! I'll probably ask you for it if you don’t.
Detailed steps to reproduce the problem:
- Get image with transparent background
- Use imgcat with it and pipe it into a text file
- Delete the trailing newline from the file
-
cat image.txt
inside right prompt (and also set proper width for zsh)
What happened:
background before and after image will be the correct one but background behind image will be the default one
What should have happened:
background behind image should be the same as before/after
The interesting part of my prompt setup (a modified version of agnoster):
prompt_segment() {
local bg fg
[[ -n $1 ]] && bg="%K{$1}" || bg="%k"
[[ -n $2 ]] && fg="%F{$2}" || fg="%f"
if [[ $THEME_SIDE == "left" ]]; then
if [[ $THEME_BG == '' ]]; then
echo -n "%{$bg%}%{$fg%} "
elif [[ $1 != $THEME_BG ]]; then
echo -n " %{$bg%F{$THEME_BG}%}$THEME_LEFT_SEGMENT_SEPARATOR%{$fg%} "
else
echo -n "%{$bg%}%{$fg%} $THEME_LEFT_SEGMENT_SAME_COLOR_SEPARATOR "
fi
else
if [[ $1 != $THEME_BG ]]; then
echo -n " %F{$1}$THEME_RIGHT_SEGMENT_SEPARATOR%{$bg%F{$THEME_BG}%}%{$fg%} "
else
echo -n "%{$bg%}%{$fg%} $THEME_RIGHT_SEGMENT_SAME_COLOR_SEPARATOR "
fi
fi
THEME_BG=$1
THEME_FG=$2
[[ -n $3 ]] && echo -n $3
}
prompt_right_end() {
if [[ -n $THEME_BG ]]; then
echo -n " %{%k%F{$THEME_BG}%}"
else
echo -n "%{%k%}"
fi
echo -n "%{%f%}"
theme_reset_colors
}
prompt_env_icons() {
local s=' '
local icons=""
if ()(($#)) *.xcodeproj(NY1) || ()(($#)) *.xcworkspace(NY1); then
local icon_xcode="%F{black}\ue20f "
icons+="$icon_xcode"
fi
if [[ -a "$PWD/Package.swift" ]]; then
local icon_swift="%{$(cat $THEME_DIR/swift.logo.txt)%2G%}"
icons+="$icon_swift"
fi
if [[ -a "$PWD/Gemfile" ]]; then
local icon_ruby="%F{red}\uf219 "
icons+="$icon_ruby"
fi
if [[ -a "$PWD/Pipfile" ]] || ()(($#)) *requirements.txt(NY1); then
local icon_python="\U1F40D "
icons+="$icon_python"
fi
if [[ -a "$PWD/package.json" ]]; then
local icon_node="%F{34}\uE617 "
icons+="$icon_node"
fi
if [[ "$icons" != "" ]]; then
prompt_segment white black "$icons"
fi
}
THEME_RIGHT_PROMPT="prompt_env_icons prompt_core_version"
theme_build_right_prompt() {
THEME_SIDE="right"
setopt shwordsplit
for segment in $THEME_RIGHT_PROMPT; do
unsetopt shwordsplit
$segment
done
prompt_right_end
}
RPROMPT='%{%f%b%k%}$(theme_build_right_prompt)'
Image and generated text:
Result: