-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
[Accessibility] Low contrast / readability of matches, highlights, and selected text. #17890
Comments
Updated the issue to focus more on the actual problem and suggest a solution. |
@juliangarnier I'm curious to hear what you think about This PR completely removes color blending with foreground colors, (which is more like how CSS Text selection is an interesting case. I'm of the opinion that this is clearer: ![]() Than this: ![]() I think we have 3 main options:
Chrome & Firefox SelectionsI think browsers are a good reference example here as they've spent a lot of time thinking about accessibility, and how they do text selection.
FigmaHowever, it appears that tools like figma appear to be potentially doing an "overlay" color (over the text) as opposed to a background color (under the text) ![]() ![]() Relation to my PRMy PR linked above, may partly solve some of these issues, particularly in cases like comments, where currently, most themes use a "gray" color. This breaks accessibility guidelines. Instead, what my PR will enable is the usage of transparent foreground colors, such as This is the difference: You can see that the left has better contrast, as the whiteness is applied over the blue selection, whereas on the right, the foreground brightness stays constant (this leads to reduced contrast during selection) |
I'm guessing you're asking about the
It is but my idea is to provide a more global solution to color highlighting, not only selection.
Not exactly. The idea is to have an optional There is also the SublimeText way: The selection foreground can be optionally set at the syntax level, allowing fine grained highlighting depending of what part is of the code is selected: {
"scope": "comment",
"foreground": "color(var(grey))",
"selection_foreground": "color(var(bg2))",
} hl.mp4
This won't guaranty good contrast though, or requires som contrast checking checking (Sublime allows that at the theme level too like this
I think 1. can be implemented without any breaking changes, since this it won't have any effect if a I think it's important to find a general solution that can improves every part of the highlighting system, not only selection. For example, search results highlights, where losing syntax highlighting is less important than losing contrast: The nice thing about the solution of adding an optional |
Sublime has a really nice theming system indeed |
+1 on ability to create borders for selections |
Check for existing issues
Describe the feature
Problem
Selected text, matches and highlights can result in low contrast / unreadable text:
Hard to read text in search results:
![Screenshot 2024-09-17 at 09 29 56](https://private-user-images.githubusercontent.com/1268691/368064722-938bc3df-826f-47ec-a90a-6cea71d82b7d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjE0MjAsIm5iZiI6MTczOTI2MTEyMCwicGF0aCI6Ii8xMjY4NjkxLzM2ODA2NDcyMi05MzhiYzNkZi04MjZmLTQ3ZWMtYTkwYS02Y2VhNzFkODJiN2QucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDgwNTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YTA5ZmU1ZTkzMmRjYjY1ZTYzODYwYjhjN2Q2MGZjOTA5NTcyMGFmODBmODk1MzIwNTEwNTgyOGIyMzRmM2Y3ZSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.Vj74aWuu4nLzPup2-KEA1i1OqRZmhn3qj5eWvLXRAOY)
![Screenshot 2024-09-17 at 09 57 50](https://private-user-images.githubusercontent.com/1268691/368066766-bd633349-bd81-48c2-9671-f2dce740d7b0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjE0MjAsIm5iZiI6MTczOTI2MTEyMCwicGF0aCI6Ii8xMjY4NjkxLzM2ODA2Njc2Ni1iZDYzMzM0OS1iZDgxLTQ4YzItOTY3MS1mMmRjZTc0MGQ3YjAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDgwNTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9ZjQ2ZmVjZTBhNGY2ODUyOGQ4ZmMyYjI3ZTdiZWY0M2ZhMzhkNThhYzU1YWViMjE5YzBiNTgzM2U1ZjJlM2NkMCZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.wObYrCuG7CharUJPEpbuacjvK-C2OX4ukAf007NcjbU)
Selecting a text can in some cases make it harder to read:
![Screenshot 2024-09-17 at 09 31 20](https://private-user-images.githubusercontent.com/1268691/368065132-284a7a8f-fcbc-4b51-b125-c82fe0b8e800.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjE0MjAsIm5iZiI6MTczOTI2MTEyMCwicGF0aCI6Ii8xMjY4NjkxLzM2ODA2NTEzMi0yODRhN2E4Zi1mY2JjLTRiNTEtYjEyNS1jODJmZTBiOGU4MDAucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDgwNTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9NDNjMjZlMmFhYWRlYTAwZGU3NmM3OTJkM2Y2YzUzMTkzMzA2MGUxNWM1OTcwOWUxOGY4OWVkMThhMTllMzE2YiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.hu_420ZZlB7fhd8Xw5NE0HZB2-nRmvL-YSMRg0Y--EY)
Matching brackets are almost unnoticeable:
![Screenshot 2024-09-17 at 10 00 23](https://private-user-images.githubusercontent.com/1268691/368068599-0f9c43fd-e20f-45c3-b958-c87c6d03d99a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkyNjE0MjAsIm5iZiI6MTczOTI2MTEyMCwicGF0aCI6Ii8xMjY4NjkxLzM2ODA2ODU5OS0wZjljNDNmZC1lMjBmLTQ1YzMtYjk1OC1jODdjNmQwM2Q5OWEucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIxMSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMTFUMDgwNTIwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTMwNWNjNzBhNDhmODYzMTZiZjNlZjIxYzA5YWQwYjRhODVkZWI0OGI3NzRmZTEyM2Q1NGFkNWQxODM1MWQ5YSZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.SF9v4FfnLMLGsnPpnJK83Yt0Fr61EFLUXDRb10kDd5M)
Currently themes rely on transparency / blending color for highlights, but this causes a lot of issues (#7333, #17599, #16380, #4678, #4859), and I think they could all be addressed with this:
Solution
Expose an optional foreground color property for each of the different match / highlight / selection styles:
If applicable, add mockups / screenshots to help present your vision of the feature
By manually setting high-contrast background and foreground colors to these properties, we make sure the text will alway be readable in all scenarios:
The text was updated successfully, but these errors were encountered: