Toolbar in DarkMode keeping LightMode accentedcolor

Sam,
unfortunatelly I’m still using App Wrapper 3.
But Mail/Safari (although not built with Xojo) work OK.
Xojo’s preferences too work OK.

That’s why at present I’d would stick to the canvas issue which does not imply any wrong code from my part.
I don’t want to appear too stubborn, but my guess is that the issue is related to Intel machines. If the canvas test works OK on Intel machines too, then I’ll infer that I have problems with my Intel MBP.

No, I do not have Ohanaware App Kit.
My code for the toolbar is based on the blog posted by Xavier.

But as I said in my previous post, I’d restrict testing to canvas behavior on Intel macs (somewhere above in this topic).

ControlAccentColor does not change between light and dark. [Edit: See below, ControlAccentColor sometimes changes.] When set to blue, calling [NSColor controlAccentColor] in both dark and light, fresh launch between changing to avoid any possibility of caching, I get &c0A5FFE00. At the very least, it’s not a Xojo bug, but I believe it’s also just not a bug.

Yes, I too get &c0A5FFE00, both in light and dark mode.
And after deleting the Xojo cache and switching to dark mode I launched Xojo and tested my app. It always shows &c0A5FFE00, as I had noticed before.
If so, do I rightly understand you, saying that the following snippet should show exactly the same color both in dark and light mode? Because I thought that the expected colors’d be darker and lighter blue. Utterly confused.
Sub Paint(g As Graphics, areas() As REALbasic.Rect) Handles Paint
var c as color = ColorGroup.NamedColor(“controlAccentColor”)
g.ForeColor = c
g.FillRect 0,0,g.width,g.Height
End Sub

Thank you, Thom.

Yes. Apple seems to return the exact same blue for both. They didn’t define a different color for dark mode. Red, on the other hand, returns &cD5202F00 in light mode and &cFB384500 in dark mode. So it depends entirely on how the accent color was defined. It may change, it may not.

Yes, in dark mode, Purple returns &c92379600; Red returns &cFB384500; Yellow returns &cFDBB0900. But such colors differ from what one sees, for instance, in the Preferences of Mail/Safari, which are more or less &cFC7EFF (purple), &cFC869100 (red) and &cFFFF24 (yellow) etc.
Actually, in dark mode, all the tabs in the Preferences of Mail/Safari (and Xojo), both labels and system-images, seem not to return the accented colors (which as you said, do not change); they are more or less &c0A5FFE00 (for blue) etc. as I pointed out in my snippet somewhere above.

Well the app itself may be adjusting the colors for better contrast. It’s what I do.

Thank you.

App Wrapper 4 preferences look correct. Is this the part where you tell us Toolbar icon coloring is not ControlAccentColor?

Hi Tim, I cannot tell you, because not having App Wrapper 4 I do not know how it looks.
Anyway, also Greg (by whose suggestion I had opened a bug report) cloded it for the same reason that accented colors do not change between light and dark mode; except some exception (purple, red and yellow), and these three accented colors too do not match what one sees in Safari/Mail.
As Thom put it: “the app itself may be adjusting the colors for better contrast. It’s what I do.”
Therefore I thank all who partecipated on this issue.

I don’t know, I’ve never bothered to check. Which I think makes my point, the code used in App Wrapper 4, The App Kit 2021 - Building Better Mac Applications and my other apps, doesn’t colorize the Preferences icons, it sets the icons in such a way that the system will automatically colorize the highlighted icon to whatever when it is, when needed. I am going with the OS for this, not against it.

p.s. If you would like to know what color the system is using (as there are several variants), download Aqua Swatch and use that to compare. Aqua Swatch 2.0 will ship this coming week :slight_smile:

1 Like

Thanks for the info. I too am not a fan of the “fake it 'til you make it” approach that’s become popular and even recommended by the Xojo Blog. It’s a hack and I would never do so in a professional manner.

1 Like

Carlo,
You can download the demo of App Wrapper 4 from the following link.
https://ohanaware.com/appwrapper/

You can download the demo of the Ohanaware App Kit from the following link.
https://ohanaware.com/appkit/

Both of which use the same solution for the preferences window, the code to do it available if you purchase the Ohanaware App Kit.

Sam,
I tested the Prefs window of App Wrapper 4 with all the accented colors, both in light and dark mode, and yes, everything works all right (well, knowing you, I already knew that everything’d be OK).

Just a small thing: everytime one opens the Prefs window:

  1. no tollbarbotton is “pressed”, therefore all buttons are “gray”.
  2. after pressing it (General) the first time, it remains “gray”, as shown in the pct below.
  3. the second time you press it, it gets its proper color.

Screen Shot 2021-10-29 at 10.43.10 AM

1 Like