microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.14k stars 29.28k forks source link

Inline suggestions are not displayed as ghosted text with HC themes #146670

Open Z-E-D opened 2 years ago

Z-E-D commented 2 years ago

I don't see any reason why inline suggestions wouldn't be displayed as ghosted (grayed) text with high contrast themes. Currently, they are white with all dark HC themes and black with all light HC themes.

I would like if you add one new color setting available to themes for foreground color of inline suggestions and maybe even another setting for their background color.

hediet commented 2 years ago

There is editorGhostText.foreground and editorGhostText.background!

If you like, you can file a PR to adjust the colors for the HC theme.

Z-E-D commented 2 years ago

Thanks for these settings, I didn't know they exist. I will use them with my own theme.

However, I am not sure if this issue should be closed. I think it is not right way to report issues to author of each HC theme to include these settings.

None HC theme that I tried has these settings included, including your own dark and light HC themes, and GitHub HC themes. So, with such themes VSCode code use default colors, which should be modified in the program to behave as a ghosted text.

hediet commented 2 years ago

So, with such themes VSCode code use default colors, which should be modified in the program to behave as a ghosted text.

I'm to open to accept a PR to change the default values (please with before/after screenshots)!

Z-E-D commented 2 years ago

I am sorry, I am relatively new to this whole GitHub thing and not as good programmer as you are. So, I suppose it would be better if you do that.

Here is the line in code that contains the default values: https://github.com/microsoft/vscode/blob/81d1f4d5f07b53703cdb237caddaa6a400217500/src/vs/editor/common/core/editorColorRegistry.ts#L48

You should replacehcDark: null, hcLight: null with hcDark: Color.fromHex("#ffffff56"), hcLight: Color.fromHex("#0007"). These are the same values as for non-HC themes.

Here is what I got after patching the workbench.desktop.main.js file that contains that line: Dark High Contrast before: Before - Dark

after: After - Dark

Light High Contrast before: Before - Light

after: After - Light

GitHub Dark HC before: Before - GitHub Dark

after: After - GitHub Dark

GitHub Light HC before: Before - GitHub Light

after: After - GitHub Light

hediet commented 2 years ago

Thanks for the gifs! A simple screenshot would have been enough though ;)

However, I strongly think that these colors do not meet the required contrast ratio for "high contrast" themes. You can use the tool "Colour Contrast Analyzer" to measure the contrast. It should have at least the ration 3:1, if not 4.5:1.

I am sorry, I am relatively new to this whole GitHub thing and not as good programmer as you are. So, I suppose it would be better if you do that.

You can press . to launch vscode.dev. There you can easily create a branch and file a PR! That has nothing to do with programming.

Z-E-D commented 2 years ago

Ok, thanks.