* Query the terminal's color-scheme preference with DSR (`CSI ? 996 n`). * Terminals that support the color palette notification protocol reply with * `CSI ? 997 ; 1 n` for dark or `CSI ? 997 ; 2 n` for light.
({ timeoutMs }: { timeoutMs: number })
| 1863 | * `CSI ? 997 ; 1 n` for dark or `CSI ? 997 ; 2 n` for light. |
| 1864 | */ |
| 1865 | queryTerminalColorScheme({ timeoutMs }: { timeoutMs: number }): Promise<TerminalColorScheme | undefined> { |
| 1866 | return new Promise((resolve) => { |
| 1867 | let settled = false; |
| 1868 | let timer: NodeJS.Timeout | undefined; |
| 1869 | let unsubscribe: () => void = () => {}; |
| 1870 | const settle = (scheme: TerminalColorScheme | undefined) => { |
| 1871 | if (settled) return; |
| 1872 | settled = true; |
| 1873 | if (timer) { |
| 1874 | clearTimeout(timer); |
| 1875 | timer = undefined; |
| 1876 | } |
| 1877 | unsubscribe(); |
| 1878 | resolve(scheme); |
| 1879 | }; |
| 1880 | |
| 1881 | unsubscribe = this.onTerminalColorSchemeChange(settle); |
| 1882 | timer = setTimeout(() => settle(undefined), timeoutMs); |
| 1883 | this.terminal.write("\x1b[?996n"); |
| 1884 | }); |
| 1885 | } |
| 1886 | } |
nothing calls this directly
no test coverage detected