Unexplained black window on Mac

I have a user who shared this screenshot, which I can’t explain, even after looking through every display accessibility option:

A few facts that may or may not be relevant:

  1. The window does NOT have a custom background color.
  2. All colors in the app come from named color groups obtained from the constructor variant, so they are system-supplied colors.
  3. Dark mode is NOT turned on.
  4. The window visible in the background is likely Discord, which has its own dark mode, so don’t let that throw you off course.
  5. 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.
  6. 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.

There’s an option in accessibility to invert colors. That’s what this looks like to me as the shadows are all white… and it wouldn’t surprise me if Listbox doesn’t handle this natively.

I know there was a recent feature request to allow apps to be notified via AppearanceChanged if an accessibility color change was made.

I tried that. Invert colors works well. The shadows are just white in light mode to add a minor beveling effect. The purple would be green if inverted too. So it’s not that.

That’s your DarkMode:

How did you manage to make such a special screen… ? image

What can you tell me about your system? Because this is the screenshot I just took.

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.

MacBook Air/M1
Scrollbar always showing
Automatic wallpaper tinting is off
I don’t think I have anything special in Accessibility

My own windows switch fine:

1 Like

Hmm. I wonder if ColorGroup isn’t working correctly on M1 Macs. Would you mind trying my app in Intel mode? You can do that from Finder’s Get Info window.

Do you also set the colours in the listbox with ColorGroups?


The complete example code for ColorGroup is the following:

If myColorGroup = Color.Blue Then
Canvas1.DrawingColor = Color.Blue
Canvas1.DrawingColor = Color.Red
End If

This is way thin.

Yeah… it’s a ColorGroup bug on M1 Macs. Fantastic…

Yes, the list box is done with color group too. Maybe 2021r1 fixes it, but I’m not in a position fully vet the new version. I might have to switch back to non-universal for now.

How the he… do I use a ColorGroup so that the colors switch automatically? I don’t understand how this is supposed to work. And the docs are beyond thin.

Forum to the rescue. But the ColorGroup works fine:

Sub Open() Handles Open
  myColorGroup = new ColorGroup(rgb(0,0,0), rgb(255,255,255))
End Sub

Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
  g.DrawingColor = myColorGroup
End Sub

In LightMode there is a black rectangle and in DarkMode a white one.

Use secondaryContentBackgroundColor and primaryContentBackgroundColor for your group names.

There’s definitely something wrong with them. Hell, if you want to try the source yourself, it’s all on GitHub: GitHub - thommcgrath/Beacon: An editor for the Beacons in Ark: Survival Evolved under the SystemColors module. But really, I don’t expect you to. I’m just going to punt on the M1 native code until Apple releases a model I actually want to buy. This sucks.

For both colours I don’t see a difference between ARM and Intel in Dark and Light Modes.

Have you tried system/named colors?

Look at the three buttons of the window; they are red, yellow/orange and green, as they should. Not inverted.

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
  End If
  Return mColorGroupsSupported
End Function

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.

1 Like

I also notice when in AS mode, the BEACON in dark mode is black while setting to intel mode, it is showing as white

Have you emailed @Christian_Schmitz (hopefully if not this tag will catch his attention)

Edit: Oh nevermind, I understand now.