[ANN] macOSTools LCB Lib v.1.0.1 Native Dark Mode

Find out what's going on with LiveCode (the company), product releases, announcements, and events.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

PaulDaMacMan
Posts: 617
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: [ANN] macOSTools LCB Lib v.1.0.1 Native Dark Mode

Post by PaulDaMacMan » Tue May 10, 2022 3:20 am

Klaus wrote:
Fri May 06, 2022 5:05 pm
Five minutes later...

OK, changing the stack from "System Window" to "toplevel" cured the crash and "dark mode" works as advertized!? :D
Great, thanks a LOT!

However the window title stays black after setting to "light" again with -> setAppToLightMode
Using "setWindowToLightMode the windowID of this stack" makes if white again.
But this throws an error: IDEToLightMode -> in stack "macOS Tools Tester"
IDEToLightMode (and of course IDEToDarkMode) are scripts that I've added to the Home stack of the modded IDE that I've been working on (and which is now the target for this library), these scripts further modify the IDE stacks in memory, this is because some IDE stacks do not look correct when simply setting a dark appearance on the stack window's NSWindow.appearance property. To look correct in darkmode, sometimes graphics, icons and text needs to changed to be white on dark or dark on light to be readable. If you set your text fields to "default"/empty for text and background color, then those should automagically get flipped dark/light by the OS (inherits it's property from NSApplication obj / macOS). You may need to set some colors in your own darkmode scripts or adjust some graphics if you plan on using this. You'll see what I mean if you browse some stacks with the IDE in darkMode.

"System Window" not compatible... I'll have to look into this further and do some testing. I have not had any crashes using this, and now tested on 12.3, but again I'm using a modded IDE now and it's fairly well modified.

NOTE: that the setLCtoDarkMode handler was a proof of concept at first, because without modifying some of the IDE stacks, it wasn't all that usable for the IDE itself (but I've been working on those IDE stack mods too). I'm not sure what name I settled on, setAppToDarkMode, I think. What this handler does is sets the .appearance property on the top level NSApplication object instead of an NSWindow object, then all of an app's windows inherit that appearance (unless something changes again). Anyway this should be generally useful for standalones as long as you design you stacks with the graphical constraints in mind.
As I mentioned to you on FB I have a couple of other NSWindow related handlers that could be useful on macOS, such as that "blurred transparency background" material, as well s the newer the "Unified Titlebar" macOS window style, which I intend to add to the library eventually.
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Klaus
Posts: 13814
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: [ANN] macOSTools LCB Lib v.1.0.1 Native Dark Mode

Post by Klaus » Tue May 10, 2022 9:22 am

AHA, thank you for the detailed explanation!

Keep the additions coming, much appreciated! :-)

Post Reply

Return to “Announcements”