microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.9k stars 8.34k forks source link

Ship a sensible default light color scheme #14859

Open mcclure opened 1 year ago

mcclure commented 1 year ago

Description of the new feature/enhancement

In #14844 there is an interesting comment from a Terminal team member:

We really wanted to revisit the fact that for most users (who haven't set the OS theme), when they launch the Terminal, they get a window that's mostly black, with a white titlebar. This contrast seemed a little silly to us.

Well, that is a little silly, but there's another way to address the silliness: what if the window contents were some color other than black?

I personally prefer black text on a light background for my terminals. However, Windows Terminal does not realistically support this. There is a "color schemes" feature and several included light themes, but they do not work with out-of-the-box Windows Services for Linux. By "do not work" I mean that the ubuntu defaults result in extremely light text on a white background, or dark text on a dark background. For example here's the One Half Light theme running "ls":

image

Look how difficult this is to read if there are one-letter directories:

image

I obtained all three of Windows Terminal, WSL, and One Half Light from Microsoft, but despite all being in some sense Microsoft products they are configured in a way that using the three at the same time does not work.

Moreover, selections are still white-background with One Half Light, so it's very hard to tell which areas are selected:

image

Proposed technical implementation details (optional)

I'm not sure I know exactly why this is happening and I don't know what the solution would be. Maybe there is a Terminal color scheme somewhere on the Internet that fixes it fully, maybe I can configure something within Bash to change the colors WSL outputs. But given MS Terminal does ship the One Half Light theme out of the box, it would be reasonable to expect it to work out of the box.

Moreover, I note Apple's Terminal.app does not have this problem without anything needing to be configured— it has a (default) light-on-black scheme and it works fine even when SSHing into remote servers where nothing has been preconfigured. I think the way Apple swung this was they silently invert the color of all foreground or background terminal colors. This probably makes multicolor ANSI art look wrong, but since that basically never comes up it is okay.

My "expected behavior" is that Terminal should ship with at least one color scheme with a light background that can be used without making things unreadable and without me needing to edit any JSON, whatever is necessary to make that happen.

237dmitry commented 1 year ago

I think it's because of the different color order in Windows and other systems. Compare:

Screenshot 2023-02-16 112208

Accordingly, the order of colors in color schemes is perceived differently in Linux and Windows.

zadjii-msft commented 1 year ago

Alrighty there's a lot to unpack here.

Forst off - the selection thing is tracked in #8716, so I won't touch that.

You're right that the "One Half Light" colors are fairly hard to read. Here's OHL vs OHD: image. The blue and green combo ls uses has been a perennial thorn in our side.

Looks like we got those schemes from https://github.com/sonph/onehalf. Not sure if they've been updated since, maybe that's something to take a look at. I think we initially tried to ship some halfway decent, inoffensive schemes, but alas, pretty much all of them have burned us.

I'm gonna just take this as an action item for "ship a sensible default light scheme". It can probably just be "Campbell Light", with the foreground & backgroundreversed.


As an addenda, @DHowett mentioned correctly that we should probably figure out "don't put all the default color schemes in the user's settings file" before shipping this. I believe he had a WIP PR over in #12800. That PR also attempted to remove the default schemes from the user's file, if they were left there by an earlier version ("healing" the file). That's probably the hardest part.

mcclure commented 1 year ago

Neat!

One thing I wonder: The color scheme only seems(??) to include 16 colors; is it worth worrying about what if an app (Linux or Windows) uses ANSI color codes 16 through 255? For example if your scheme only rewrites 0-15, then background 15 and foreground 16 might look like black on black.

237dmitry commented 1 year ago

There are base 16 console colors, plus foreground, background, selection and cursor. Color scheme replaces these 16 colors with their own.

(Linux or Windows) uses ANSI color codes 16 through 255?

A palette of 256 colors is given for convenience, this is the generally accepted standard. In practice, this palette is enough for the console, but no one forbids the use of RGB colors.

PinkSerenity commented 1 year ago

I think a solution of changing the expected colors as implemented by Apple's Terminal is at most a workaround that should not be considered as the end of the problem. Of course an inverted mode should still be included as a feature, but the big underlying issue is that there is no convention on how to tell command line shells and programs whether to use light or dark mode.

However, terminals and programs have become aware of it and have proposed different solutions. The xterm and the vte library specify OSC 10 and OSC 11 for querying text foreground and background, respectively. This is utilized be Emacs running on these terminals. Rxvt on the other hand sets a new environment variable COLORFGBG.

However, both of these solutions aren't widely supported. I still suggest implementing them in Windows Terminal (if they aren't already implemented), because "be the change you want to see".

Source

zadjii-msft commented 1 year ago

@Tojaw the OSC10 (et al) queries are tracked in #3718

kfsone commented 1 year ago

The problem is that there's no readable default Light Mode color scheme.

One Half Light results in ".." in powershell being invisible. Tango Light uses light gray for concrete typing but dark for autocomplete which is confusing.

One half light: image

Solarized Light: image

Tango Light: image

Is this an issue with powershell using colors by name instead of role?

kyle-semc commented 1 year ago

I've made a few fixes to colors that made it impossible to work.

sassdawe commented 1 year ago

Could I bring to your attentionPresentLight? https://gist.github.com/sassdawe/2006949bf04ebdf1d5627e6fac3f1db7

This was born during PSConfEU as no one had a good light theme to present on the big "screen". I think this would be very handy if included in the default install - to be used on throw-away virtual machines created for conference demos.

I am not really sure how could I submit a PR with this, but with some direction I'd be happy to create one!