microsoft / winget-cli

WinGet is the Windows Package Manager. This project includes a CLI (Command Line Interface), PowerShell modules, and a COM (Component Object Model) API (Application Programming Interface).
https://learn.microsoft.com/windows/package-manager/
MIT License
23.28k stars 1.45k forks source link

Feature request: improve colors / highlighting of commands in Windows Terminal #986

Open Karl-WE opened 3 years ago

Karl-WE commented 3 years ago

Brief description of your issue

color of winget commands is good to recognize compared to console

Steps to reproduce

open cmd or PowerShell Console type winget

open Windows Terminal (Preview) type winget

Expected behavior

both consoles show clear yellow highlighting for winget commands image

Actual behavior

Windows Terminal on the contrary have too similar (white vs light grey) colors, no matter predefined color scheme. image

Environment

Windows Package Manager v0.4.11391 Vorschau Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.

Windows: Windows.Desktop v10.0.21387.1 Paket: Microsoft.DesktopAppInstaller v1.11.11391.0

Protokolle: %LOCALAPPDATA%\Packages\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe\LocalState\DiagOutputDir

Any other software? Windows Terminal Version: 1.8.1444.0

Windows Terminal Preview Version: 1.9.1445.0

denelon commented 3 years ago

Several challenges arise when users customize their colors. We defaulted to "bold" so we could retain "high contrast". We will have to look further into accessibility concerns here.

Karl-WE commented 3 years ago

Thank you @denelon I have tried all the default color presets in Terminal and don't see a difference. Maybe someone at @cinnamon-msft team could doublecheck this with the default colors (Windows 10 Insider Dev 21387 set to dark mode maybe this makes a change?

DHowett commented 3 years ago

@Karl-WE winget is requesting "default color, bold/bright". The default color is, in every terminal emulator pretty much everywhere, some shade of gray. The bold/bright variety of that color is white. Pretty universally :smile:

The default color schemes of Terminal do in fact have white in the "white" slot. This is equally true of the Windows PowerShell color scheme outside of Terminal. There is no variation by system color scheme.

Hope that helps!

DHowett commented 3 years ago

Ah, but the confounding factor is this:

In the default "Windows PowerShell" color scheme, they have replaced dark yellow with gray (therefore deleting dark yellow from the palette completely) and the "bright" version of that is, of course, bright yellow. They then set the "default color" to be dark yellow. Which is rendered as gray.

This is widely regarded as a bug and as a significant mistake, and they've already stopped doing it with the default configuration of PowerShell (6.0+).

DHowett commented 3 years ago

image

image

The "corrupted" colors are NORMAL/3 and NORMAL/5. When winget says "Brighten the color" it gets BRIGHT/3. This only works because Windows PowerShell's default colors are damaged.

If you run it form cmd, it won't be highlighted in yellow:

image

:smile:

Karl-WE commented 3 years ago

@DHowett good to know Dustin. So how should we carry on with this PR?

DHowett commented 3 years ago

If I had to make an official recommendation -- which I cannot, as this isn't my repo :smile: -- I'd say "Brightening or boldening the user's default color is an acceptable way to make it stand out; there isn't anything further to do here."

If the team wants to ensure that it is always bright white or bright yellow (regardless of the user's background color, which is unknowable and this can get you into trouble) I'd suggest they use \e[93m ("bright yellow", explicitly, without bold).

This is going to become at least moderately annoying when Terminal finally has support for bold text instead of bright text, because it will be the same amount of gray or yellow or what-have-you but just bold.

Karl-WE commented 3 years ago

I see you Dustin, I would not pin it to a fixed color, who knows that has a weakness and even wants a yellow background in Terminal / Console or stuff.

We also should consider to test it with the Windows 10 color weakness modes or the high contrast colors (my old dad uses this mode).

I am aware that's a high goal for MSFT to have inclusion and help people with disabilities so that's why I flagged this in the first place.

DHowett commented 3 years ago

In an ideal world, Terminal itself would have some colormetric algorithm for resolving contrast issues. There are a couple of them that exist already and as simple mathematical transformations we should be able to use them. We're tracking adding support for one at microsoft/terminal#2638.

High Contrast mode could bump up the required delta between colors. That would be clever, and perhaps it would work too.

Trenly commented 1 year ago

[Policy] Area-Output

Trenly commented 1 year ago