dotnet / dotnet/fsharp

Make sure color themes handling in VS is up to date

Open
#16,300 1 comment 0 reactions 0 assignees View on GitHub
AI-thinks-windows-only Area-VS-Editor Bug Impact-Medium
Dominant language
F#
Stars
4.3k
Forks
876
Avg merge
4d 22h
Merged PRs (30d)
144

Description

Latest VS preview introduced refreshed UI, with lots of new color themes:
image

We have a mechanism that used to update F# specific semantic colors on theme change, to make sure there is enough contrast in dark and light themes:
https://github.com/dotnet/fsharp/blob/5cdf959c95560aaf408d25bb69ccab1335166be1/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs#L94-L104

Not only this will not detect any of the new themes, but this code also predates dark mode in Windows, so it does not properly handle "Use system setting" in VS:
image

In effect some code can get barely readable unless you set the colors by hand. Not a good first experience for newcomers etc.:
image

Looks like in the meantime Roslyn tackled that problem, too:
https://github.com/dotnet/roslyn/pull/31976
https://github.com/dotnet/roslyn/pull/39792
so we could probably look at their current state of things and borrow some ideas.
(There's a thing called [ColorSchemeApplier](https://github.com/dotnet/roslyn/blob/dffe39182a44401510433d308d486c6dd1bf820e/src/VisualStudio/Core/Def/ColorSchemes/ColorSchemeApplier.cs), probably worth a look).

Some questions to consider:

- do we still have to do it at runtime, or can it be handled when installing the vsix?
- how to handle `KnownColorThemes.System` theme when it doesn't really tell us if it's dark or light? Maybe, instead of handling every VS theme possible, just peek at the editor window background color?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.