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.:
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?
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: 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:
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: 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:
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?