Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dark colors are printed incorrectly with FormattedTextOutputDeviceData #3821

Closed
bradwilson opened this issue Sep 12, 2024 · 3 comments · Fixed by #3825
Closed

Dark colors are printed incorrectly with FormattedTextOutputDeviceData #3821

bradwilson opened this issue Sep 12, 2024 · 3 comments · Fixed by #3825
Assignees
Labels
Area: Testing Platform Belongs to the Microsoft.Testing.Platform core library In-PR Type: Bug

Comments

@bradwilson
Copy link

I noticed that dark colors (that is, Black and all the color names starting with Dark) are printed incorrectly, and are rendered as their lighter counterparts instead of the dark versions.

Here is a comparison between Console.WriteLine and IOutputDevice.DisplayAsync:

image

The Console version:

Console.WriteLine("This is the default color");

foreach (var consoleColor in Enum.GetValues<ConsoleColor>())
{
    Console.ForegroundColor = consoleColor;
    Console.WriteLine("This is foreground {0}", consoleColor);
}

The IOutputDevice version:

await outputDevice.DisplayAsync(this, new TextOutputDeviceData("This is the default color"));

foreach (var consoleColor in Enum.GetValues<ConsoleColor>())
    await outputDevice.DisplayAsync(
        this,
        new FormattedTextOutputDeviceData(
            "This is foreground " + consoleColor.ToString()
        ) { ForegroundColor = new SystemConsoleColor { ConsoleColor = consoleColor } }
    );

I've attached the repro project.

testfx.zip

@bradwilson
Copy link
Author

@nohwnd @MarcoRossignoli

@MarcoRossignoli
Copy link
Contributor

thanks for reporting this

@bradwilson
Copy link
Author

Thanks for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Testing Platform Belongs to the Microsoft.Testing.Platform core library In-PR Type: Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants