TermBuf::ColorStack
Stability: stable — changes only in a major release.
The terminal's own colours: the default foreground and background, the cursor, and the 256 entry palette everything indexed resolves through.
These are not cell attributes. Changing one repaints nothing and shows up everywhere at once, including in text this shard never wrote.
Which is why it is all gated on Capability::KittyColorStack. The stack is
what makes a change reversible: push, change what you like, pop, and the
terminal is as it was. Without somewhere to put the old values there is no
way to give them back, and a shard that leaves a terminal a different colour
than it found it is worse than one that leaves the colours alone.
terminal.colors.push
terminal.colors.background = Color.rgb(20, 20, 30)
# ...
terminal.colors.pop
Terminal#close pops whatever is still pushed, so an application that
forgets, or that stops on a signal, still gives the terminal back.
Constants
What kitty's colour stack listens for: OSC 30001 ST saves, OSC 30101 ST restores. These are the sequences the capability is named for. xterm
later took the idea with CSI # P and CSI # Q, and kitty accepts those
too on paper, but kitty 0.48.2 was seen to ignore the xterm form and
answer its own.
Constructors
Instance methods
Restores the colours saved by the matching #push. Does nothing when
nothing is pushed, so an extra pop cannot walk off the end of a stack
something else was using.
Puts the palette and the default colours back to what the terminal was configured with, which is not the same as what was pushed.