Eto Dialogs - Theme Color

For those of you creating dialogs or forms using Eto, if you want to add theme color (e.g. dark, light) support to your forms, then add the following statement to your dialog or form initializer.

Rhino.UI.EtoExtensions.UseRhinoStyle(self)

For example:

class MyDialog(forms.Dialog[bool]):
    
    def __init__(self):
        Rhino.UI.EtoExtensions.UseRhinoStyle(self)
        # TODO: do additional initialization here...

I’ve attached a sample for you to review.

TestButtonDialog.zip (841 Bytes)

Thanks,

– Dale

8 Likes

This works great for Dark Mode Dale thanks!
I have some icons I invert when the mode changes, is there a way to have the style inform them, or an event I can subscribe to, to know when the style swaps?

– cs

Thanks for sharing this, very helpful!

Thanks!

For C#
The following code worked for me:

Rhino.UI.EtoExtensions.UseRhinoStyle(myform);

Doesn’t have to be in the init function.

To detect Rhino Style:

Rhino.Runtime.HostUtils.RunningInDarkMode; 

this returns a boolean.