-
Notifications
You must be signed in to change notification settings - Fork 833
Description
Latest VS preview introduced refreshed UI, with lots of new color themes:

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:
fsharp/vsintegration/src/FSharp.Editor/Classification/ClassificationDefinitions.fs
Lines 94 to 104 in 5cdf959
| let (|LightTheme|DarkTheme|UnknownTheme|) id = | |
| if | |
| id = KnownColorThemes.Light | |
| || id = KnownColorThemes.Blue | |
| || id = Guids.blueHighContrastThemeId | |
| then | |
| LightTheme | |
| elif id = KnownColorThemes.Dark then | |
| DarkTheme | |
| else | |
| UnknownTheme |
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:

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

Looks like in the meantime Roslyn tackled that problem, too:
dotnet/roslyn#31976
dotnet/roslyn#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:
- do we still have to do it at runtime, or can it be handled when installing the vsix?
- how to handle
KnownColorThemes.Systemtheme 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?
Metadata
Metadata
Assignees
Labels
Type
Projects
Status