How to get the window background color?

[quote=496155:@Beatrix Willius]@Kevin Gale: I wish. The window has 26 classes and containers.

One problem solved: Kevin’s code looks okay in Light Mode and foobars the window in DarkMode. Even if I use black as background colour.[/quote]
For Dark Mode, you might need to use a different NSAppearanceMBS value or a different material constant (we don’t bother supporting dark mode). MBS has some of the material constants defined in his class but some were missing so I had to look them up in Apple’s developer documentation.

The code I provided was something I came up with at the end of last week to address the following issues we noticed with modal dialogs on Big Sur so you might not need it all:
• Edit Field backgrounds were transparent rather than white which made it harder to tell if a field was enabled or not (first part of the code).
• The background was translucent rather than the same colour as non modal windows and it wasn’t possible to set a custom background colour (second part of the code).

We are applying the changes to an entire window but it is my understanding that the properties can be applied to individual controls.