Skip to content

Support disabling colors manually #87

@yashovardhan99

Description

@yashovardhan99

InquirerPy currently disables all colors automatically if the env var NO_COLOR is set. This seems to be thanks to prompt-toolkit/python-prompt-toolkit#1756

I am trying to find a way to manually disable all colors as described in Command Line Interface Guidelines.

Here is what I already tried:

inquirer_style = get_style({}, style_override=state.no_color)
...
inquirer.text(
    message="Input",
    validate=EmptyInputValidator(),
    style=inquirer_style,
).execute()

This seems to work for the most part, however, validation messages (such as "Input cannot be empty" in this case) still show color. These same validation messages do not show color when the environment variable NO_COLOR is set in accordance to https://no-color.org/

I realize this might not be possible at your end. And if so, I can also open an issue in the prompt toolkit repo to see if they can help with this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions