The "inverted color" is the terminal's standout capability, normally done using reverse-video (colors don't matter). A program running in screen
may send the escape sequence for standout, but screen
program happens to interpret the standard escape sequence for italics as the standout feature. So it sends italics.
If you're not actually using screen
, you're using some program which copied that (mis)feature.
Addressing a comment: tmux began by using the terminal description designed for GNU screen, which has this italics sequence as the standout capability. Later versions of tmux look first for a description designed for tmux. You can see the feature using infocmp:
$ infocmp screen tmux
comparing screen to tmux.
comparing booleans.
hs: F:T.
comparing numbers.
ncv: NULL, NULL.
comparing strings.
dsl: NULL, '\E]0;\007'.
fsl: NULL, '^G'.
...
kri: NULL, '\E[1;2A'.
ritm: NULL, '\E[23m'.
rmso: '\E[23m', '\E[27m'.
sgr: '\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;m%?%p9%t\016%e\017%;', '\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;'.
sitm: NULL, '\E[3m'.
smso: '\E[3m', '\E[7m'.
tsl: NULL, '\E]0;'.
smso
is the standout capability, while sitm
and ritm
set/reset italics.
set -ga terminal-overrides ",xterm-*:sitm@:ritm@"