dotnet / fsharp

The F# compiler, F# core library, F# language service, and F# tooling integration for Visual Studio
https://dotnet.microsoft.com/languages/fsharp
MIT License
3.89k stars 783 forks source link

Make sure color themes handling in VS is up to date #16300

Open majocha opened 11 months ago

majocha commented 11 months ago

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, probably worth a look).

Some questions to consider:

vzarytovskii commented 11 months ago

Sigh...that's something that crossed my mind recently. We'll need to do it probably. Thanks.