Skip to content

Wrong usage of ANSI terminal colors #417

Description

@peterpp

Version: 1.7.2, 2.0.2, 2.3.1

By default, tester output in terminal is colored. But those colors are used wrongly.

First of all, "bright" version of colors can be interpreted as bold text with "basic" color. So color "gray" as defined in Dumper.php can be displayed as bold black. Therefore you can't use "gray" to look texts with less importance.

Than you can't use "white" as font text because with standard ANSI colors and white terminal background, these texts will be barely visible. "white" is usable only together with colored background.

I played with output and this is my suggestion to fix it (all in Dumper.php):

  • replace ($item['file'] === $testFile ? self::color('white') : '') with ($item['file'] === $testFile ? self::color('navy') : '') to highlight file path with row number
  • replace self::color('white', $message) with self::color(null, $message)
  • replace self::color('white') with self::color()
  • replace self::color('gray') with self::color()

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions