- Using ColorGroup.NamedColor(“windowBackgroundColor”)
var grpclr as ColorGroup = ColorGroup.NamedColor(“windowBackgroundColor”)
var lesClrs() as color = grpclr.Values
var clr as color = lesClrs(0) ‘There is only one color
clr = color.HSV(clr.Hue,clr.Saturation, clr.Value/1.05)
→ we get the good color on Catalina but not the good one on BigSur
(and, despite its name, this is not the BackgroundColor of the window)
Is there a way to alter the window’s BackgroundColor (get with color.FillColor) to get the good one that will be OK on Catalina and BigSur ?
Is there a “declare” ?
Thanks for your help.!
Not sure what you want to do. I have a module for the colors (from before the colorgroups). I assign the background color in code:
me.BackgroundColor = Colors.getMailboxesColor
When the mode is changed, the code is executed again to get the correct color.
I want to fill a canvas with the same color that the groupbox background color.
Just clear the canvas and the underlying colour will show through.
g.ClearRectangle 0, 0, g.Width, g.Height
Doing that I’ll get the window’s background.
In fact on macos, I get what is beneath the canvas.
Thanks, but it is not what I need, I need to get the color (whatever I’ll do with this color right after).
AFAIK this color is not available as a constant, so you’d have to color match yourself. Most of Apple’s colors in this situation are using alpha to get the blending, so you’ll need to take that into account when trying to fake it.
Alternatively just use a GroupBox, if you don’t want a label, you can set it to “”. This way it will be consistent even if Apple change how or what they use for the background.