Setting text styles/colors in arbitrary regions of the screen#
There already exists an escape code to set some text attributes in arbitrary regions of the screen, DECCARA. However, it is limited to only a few attributes. kitty extends this to work with all SGR attributes. So, for example, this can be used to set the background color in an arbitrary region of the screen.
The motivation for this extension is the various problems with the existing solution for erasing to background color, namely the background color erase (bce) capability. See this discussion and this FAQ for a summary of problems with bce.
For example, to set the background color to blue in a rectangular region of the screen from (3, 4) to (10, 11), you use: