The window does NOT have a custom background color.
All colors in the app come from named color groups obtained from the constructor variant, so they are system-supplied colors.
Dark mode is NOT turned on.
The window visible in the background is likely Discord, which has its own dark mode, so don’t let that throw you off course.
This is an M1 Mac running a Universal app compiled with 2020r1. I’ve asked the user to try to force the app to use the Intel code under Rosetta. I no longer have my DTK to test with (thanks Apple) so I can’t run the native AS code anymore. But when I did have it, I never experienced this issue.
I don’t yet know if other windows in the app are using the wrong background color.
I suspect the user has some sort of modification in place, but I can’t find a motive for that. If they wanted dark mode, why not just turn it on? If anybody has an actual M1 Mac, not just the DTK, and would like to try this themselves, the app is free from https://usebeacon.app/download.
I’m at a loss to explain what would cause the window background to be black. Every other color is what I would expect for having dark mode turned off.
Version? Accessibility settings? Anything worth knowing? Because as I said, I’m just asking the system for colors. I’ve never seen it get things wrong before. Mine is running 11.2.3, but it looks the same on every version 10.12 and newer.
Forum to the rescue. But the ColorGroup works fine:
Sub Open() Handles Open
myColorGroup = new ColorGroup(rgb(0,0,0), rgb(255,255,255))
Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
g.DrawingColor = myColorGroup
In LightMode there is a black rectangle and in DarkMode a white one.
Ok. I have this figured out. First of all, never trust the customer. Dark mode was definitely turned on. But that’s not the cause.
To work around ColorGroup bugs in 2020r2.1 I’ve had to introduce a ColorGroupMimic class that basically uses ColorGroup on supported platforms and just returns the light mode color where it isn’t supported. This is a bug fixed for 2021r1 already, so I didn’t want to refactor all my code just to change it back later, so this allowed me minimal changes to fix the crash.
To determine compatibility, I’m using this code:
Private Shared Function ColorGroupsSupported() As Boolean
If Not mColorGroupsTested Then
mColorGroupsSupported = XojoVersion >= 2021.01 Or TargetMacOS = False Or SystemInformationMBS.isMojave(True)
mColorGroupsTested = True
So basically, if compiled using an IDE with the fix, or not a Mac, or newer than Mojave.
SystemInformationMBS.isMojave(True) is to blame, as it returns false when using the macOS 11 SDK. I’m guessing because it’s comparing the second part of the os version number. Or at least it was with 20.5. I downloaded 21.1, and isMojave(True) returns true as it should. Problem solved.