Skip to content

[BUG] COLORTERM in combination with FORCE_COLOR does not work anymore #2859

@ThunderKey

Description

@ThunderKey

Describe the bug

Commit 1ebf823 broke the combination of "FORCE_COLOR" and "COLORTERM" taken from the environment variables.

I've created a simple test:

import io

from rich.console import Console


def test_force_color():
    console = Console(file=io.StringIO(), _environ={
        "FORCE_COLOR": "1",
        "COLORTERM": "truecolor",
    })
    assert console.is_terminal
    assert console.color_system == "truecolor"

If master or 1ebf823 is checked out it fails, because the color_system is None. If the commit before (b89d036) is checked out the test succeeds.

I guess that the order of when FORCE_COLOR and COLORTERM are interpreted got changed.

Platform

Click to expand
  • What platform (Win/Linux/Mac) are you running on? Linux (Manjaro)
  • What terminal software are you using? kitty

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