Skip to content

cli: unreadable text due to forced bright colors on light terminals #751

@ayosec

Description

@ayosec

Describe the bug

The color of most text written to the console is forced to be light gray, even on terminals with a white background. The contrast is very low, and it is barely readable.

aws/aws-cdk#5242 (from 2019) seems to fix the problem, but it is present in the current version of the CLI.

Example:


Image

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Library Version

No response

Expected Behavior

Text should be readable.

Current Behavior

Text is very hard to read due to very low contrast.

Reproduction Steps

Run cdk init on a terminal with white background.

Possible Solution

A possible solution is to detect the background color with DECAC. For example, writing \e]11;?\a to a terminal with white background generates a response like \e]11;rgb:ffff/ffff/ffff\a, and \e]11;rgb:0000/0000/0000\a on terminals with black background.

If the background can't be determined, the CLI should use default color (non-bright variants), instead of forcing the the bright ones.

Additional Information/Context

No response

AWS CDK Library version (aws-cdk-lib)

[email protected]

AWS CDK CLI version

2.1022.0

Node.js Version

v22.14.0

OS

Linux

Language

TypeScript

Language Version

No response

Other information

No response

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