Open DanGrowns opened 3 months ago
Thanks for your feedback! Can you tell us a bit more about the scenario you're trying to enable where you need to get the color? What would you need the color for?
Thanks - I am using SkiaSharp to draw images onto an Image control and display them in the add-in. I natively use the dark theme and would like to be able to identify the background colour of the addin so I can swap the image's colours.
e.g. When in dark mode, set SkiaSharp background text to VS background colour and foreground to white.
Project type: Visual Studio Extensibility (preview)
Packages included:
Microsoft.VisualStudio.Extensibility.Build (17.10.2084)
Microsoft.VisualStudio.Extensibility.Sdk (17.10.2084)
Microsoft.VisualStudio.Shell.15.0 (17.10.40170)
I am trying to get a the foreground text colour in my ViewModel from the textblock dynamic resource style here: https://learn.microsoft.com/en-us/visualstudio/extensibility/visualstudio.extensibility/inside-the-sdk/advanced-remote-ui?view=vs-2022
I've created a brand-new project following the documentation above and attempted a few ways to transmit the dynamic resource to the VM.
I've tried using a CommandParameter on a button click to get the foreground colour of an element, however, when trying to transfer this as a parameter the command stops working.
I've added a reference to Microsoft.VisualStudio.Shell.15.0 to attempt to make use of:
VSColorTheme.GetThemedColor(EnvironmentColors.ToolWindowBackgroundColorKey);
However, this throws the error "this is a reference assembly".
Is there a way to get any VS theme information in the ViewModel for a out-of-process VS extension?
Thanks.