Skip to content

Some command line output ignores system foreground color configuration #1633

Closed
@jrob

Description

@jrob

What You Are Seeing?

When running in a shell with a white background, some text is invisible.

Screenshot:

screenshot

Actual text:

$ ./build.ps1 --showdescription
Preparing to run build script...
Running build script...
Analyzing build script...
Processing build script...
Installing tools...
Installing addins...
Compiling build script...

Task                          Description
===============================================================================
Restore-NuGet-Packages

What is Expected?

The output should respect the configured foreground colors so that text is visible.

What version of Cake are you using?

Version 0.19.5+Branch.main.Sha.e4c4ad2a949637f89063dc7a90363839b740af2c

Are you running on a 32 or 64 bit system?

64

What environment are you running on? Windows? Linux? Mac?

Windows 10 with the default shell.

How Did You Get This To Happen? (Steps to Reproduce)

Current colors set for the shell

$colors = [Enum]::GetValues( [ConsoleColor] )
$max = ($colors | foreach { "$_ ".Length } | Measure-Object -Maximum).Maximum
foreach( $color in $colors ) {
    Write-Host (" {0,2} {1,$max} " -f [int]$color,$color) -NoNewline
    Write-Host "$color" -Foreground $color
}

CLI Colors

Windows powershell properties.

Powershell Properties

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions