Skip to content

Italics

Romain Lafourcade edited this page Mar 21, 2023 · 2 revisions

Italics

The usual method for affecting how the text is displayed in a terminal emulator is to use escape sequences. For example, running the command below in your Unix shell should give you a red Hello!:

$ echo -e '\033[0;31mHello!\033[0m'

The exact semantics are not important but, in that simple example, the word Hello! is sandwiched between two escape codes:

  • \033[0;31m, which tells the terminal to use red from now on,
  • \033[0m, which tells the terminal to revert back to normal.

The principle is relatively straightforward: you start a "mode" (red, bold, italics, etc.), then you print some text that you want to be affected by that "mode", then you stop that "mode".

That is how your favorite package manager shows deprecation warnings and how Vim does all its visual magic.

[TBC]

Clone this wiki locally