Proper way of sending ANSI escape sequences to containing terminal emulator?

I want to increase drawing efficiency by:

  1. setting my terminal emulator’s background color to the Normal background color using ANSI escape codes
  2. setting the Normal background color to NONE

Unfortunately, I cannot find a way to send the escape sequence to the terminal.

I heard of this approach first from the creator of kitty in this issue.

Using :call writefile(['\x1b]11;blue\x1b\\'], '/dev/stdout', 'b') did not work.

The idea of using escape codes started in this Issue of my own plugin.