tty
Minimal raw-mode terminal driver.
Deliberately not curses: curses owns colour through its own limited pair table and would fight both 24-bit colour and the Kitty graphics protocol, which are the two things this whole renderer depends on. Raw mode plus direct escape sequences is less machinery and gives full control.
drain()
Discard pending input, so held-down keys do not queue up frames.
fullscreen(stream=None)
Raw mode on the alternate screen, restored however we leave.
Source code in chmpy/tui/tty.py
query_background(timeout=0.15)
Ask the terminal for its background colour via OSC 11.
Returns an (r, g, b) triple, or None if the terminal does not answer. Must not be called while another raw-mode reader is running, so query once before entering fullscreen.
Source code in chmpy/tui/tty.py
read_key(timeout=None)
One keypress, or None if timeout seconds pass with no input.