Skip to content

Support FORCE_COLOR and NO_COLOR environment variables #3022

Description

@ascopes

It would be great if the FORCE_COLOR and NO_COLOR environment variables could be used during calls to click.echo/click.secho to determine the default preference for colouring of stdout/stderr when an explicit preference for outputting colour is not set.

It appears that currently, click simply inspects whether the output stream considers itself to be a physical TTY. This is problematic on build systems such as GitLab or Jenkins or GitHub Actions, as logs that could be output in colour will not be since the output stream is still technically a file.

Supporting this would allow simpler catering for outputs that are designed to help visually impaired users when viewing automated build outputs, but may have other applications as well.

These environment variables are a good candidate to be used, because the Python interpreter already considers these specific variables, and other libraries such as colorlog also respect this.

Activity

  1. kdeldycke commented on Aug 3, 2025

    @kdeldycke
    Collaborator
  2. changed the title [-]Support FORCE_COLOR and NO_COLOR environment variables[/-] [+]Support `FORCE_COLOR` and `NO_COLOR` environment variables[/+] on Aug 3, 2025
  3. added
    help outputHelp text formatting, layout, and --help rendering
    on Aug 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help outputHelp text formatting, layout, and --help rendering

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions