Skip to content

Add support for disabling colors #259

Description

@ad-si

LayoutOptions should have a layoutColor field that lets you output the document without any colors. Another option could be to automatically read the NO_COLOR env variable as described in https://no-color.org/

Activity

  1. lehmacdj commented on Oct 27, 2025

    @lehmacdj
    Contributor

    Color isn't really a property of the layout since annotations are preserved unchanged in SimpleDocStream ann after layout but before rendering, e.g. when using layoutPretty.

    You can easily ignore colors in a SimpleDocStream AnsiColor by using unAnnotateS :: SimpleDocStream a -> SimpleDocStream xxx which removes all annotations and would thus remove all colors. If you have a mix of annotations you want to preserve you can also use reAnnotateS to remove colors without too much difficulty.

  2. sjakobi commented on Dec 1, 2025

    @sjakobi
    Collaborator

    We could consider checking for NO_COLOR or at least adding documentation about it in prettyprinter-ansi-terminal.

    I'm more inclined towards documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions