.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Theme or ThemeManager

8 REPLIES 8
Reply
Message 1 of 9
conveyor1
254 Views, 8 Replies

Theme or ThemeManager

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?

Labels (1)
8 REPLIES 8
Message 2 of 9

ThemeManager.Instance.CurrentPaletteTheme will return the current theme.

 

You need to reference AdUiPalettes.dll

Message 3 of 9
conveyor1
in reply to: conveyor1

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.

Message 4 of 9

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.

Message 5 of 9
conveyor1
in reply to: conveyor1

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_0-1735408061565.png

 

Message 6 of 9
kerry_w_brown
in reply to: conveyor1


@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 ??

2024-12-29_07-44-10.jpg


// 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

Message 7 of 9

It's not Autodesk.AutoCAD.Windows.Themes, it's Autodesk.Windows.Themes

Message 8 of 9
conveyor1
in reply to: conveyor1

Same issue:  

conveyor1_0-1735416985450.png

Not sure what I am doing wrong.

Message 9 of 9
conveyor1
in reply to: conveyor1

Got it.  I forgot to add it as a reference.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

AutoCAD Inside the Factory


Autodesk Design & Make Report