I am looking to get the current light or dark mode settings from the AutoCAD program to apply the correct settings to a custom form. From the searches, I have seen some references to using ThemeManager and others use getSystemVariable("COLORTHEME") and AutoCAD.Interop. The ThemeManager I am not able to get to come up in VS even after loading the AdUiPaletts.dll and the Interrop way gives me a different error on initializing the form. Has anyone done this before or have any recommendations?
ThemeManager.Instance.CurrentPaletteTheme will return the current theme.
You need to reference AdUiPalettes.dll
Morning. I was able to get it this way:
var currentColorTheme = Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable("COLORTHEME");
with 0 = dark and 1 = light. I did try the line above with the DLL loaded, but I was not able to get ThemeManager to work. I'm going to say it was Human error. Thank you.
The code in my post works for me. But it gives you all of the colors of the theme not just whether it is the light or dark theme. If you only need to know that then I guess the system variable will do.
Here was my issue with ThemeManager. I have the DLL loaded. But Autodesk.Windows.Themes is not available. I also tried Autodesk.AutoCAD.Windows.Theme and that also does not populate. AutoCAD version is 2022 for the DLL.
@conveyor1 wrote:Here was my issue with ThemeManager. I have the DLL loaded. But Autodesk.Windows.Themes is not available. I also tried Autodesk.AutoCAD.Windows.Theme and that also does not populate. AutoCAD version is 2022 for the DLL.
Weird that the namespace is not available ??
// Called Kerry in my other life.
Everything will work just as you expect it to, unless your expectations are incorrect.
Sometimes the question is more important than the answer.
class keyThumper<T> : Lazy<T>; another Swamper
Can't find what you're looking for? Ask the community or share your knowledge.