Skip to content

reword the section on querying the terminal #63

@izabera

Description

@izabera

In an interactive program that can read terminal responses, a more reliable method is available, that is transparent to sudo & ssh.

Simply try sending a truecolor value to the terminal, followed by a query to ask what color it currently has. If the response indicates the same color as was just set, then truecolor is supported.

If the response indicates an 8-bit color, or does not indicate a color, or if no response is forthcoming within a few centiseconds, then assume that truecolor is not supported.

this only works in a fraction of the terminals. see https://gist.github.com/izabera/3d1e5dfabbe80b3f5f2e50ec6f56eadb where i believe i tested all the ones i can run on x11 on linux natively, minus all the other vte ones

all the terminals in my test (urxvt does its own weird mapping) support truecolor, but most don't reply as expected, so suggesting it as the main way to check for support and even saying "if the response does not indicate a color assume that it's not supported" seems misguided

note that st has supported truecolor since 8dde8cd in 2013, but it doesn't expose any way to detect support

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions