1Saving and restoring colors
2==============================
3
4It is often useful for a full screen application with its own color themes to
5set the default foreground, background, selection and cursor colors and the
6ANSI color table. This allows for various performance optimizations when
7drawing the screen. The problem is that if the user previously used the escape
8codes to change these colors herself, then running the full screen application
9will lose her changes even after it exits. To avoid this, kitty introduces a
10new pair of *OSC* escape codes to push and pop the current color values from a
11stack::
12
13    <ESC>]30001<ESC>\  # push onto stack
14    <ESC>]30101<ESC>\  # pop from stack
15
16These escape codes save/restore the colors, default
17background, default foreground, selection background, selection foreground and
18cursor color and the 256 colors of the ANSI color table.
19
20.. note:: In July 2020, after several years, XTerm copied this protocol
21   extension, without acknowledgement, and using incompatible escape codes
22   (XTPUSHCOLORS, XTPOPCOLORS, XTREPORTCOLORS). And they decided to save not
23   just the dynamic colors but the entire ANSI color table. In the interests of
24   promoting interoperability, kitty added support for XTerm's escape codes as
25   well, and changed this extension to also save/restore the entire ANSI color
26   table.
27