micmac wrote: ↑Fri Jan 06, 2023 1:21 pm
Hi Paul
Opening old Livecode files in OTX...
This is the looks in Livecode
Skærmbillede 2023-01-06 kl. 14.13.04.jpg
This is the looks in OTX
Skærmbillede 2023-01-06 kl. 14.12.26.jpg
This is the look in OTX both in light and dark mode.
Thanks
Mic
Not really a bug! As I've mentioned in the past, darkMode on macOS is somewhat more than just inverting colors.
This would be the same problem in LC CE, IF they had supported native darkMode, which is probably why they didn't beyond adding an Engine-level property for checking the mode (systemAppearance) and a notification message (systemAppearanceChanged). OXT uses these two in conjunction with the included macOS tools Extension library to support native darkMode, and it works the same way when loaded into LC.
The thing I'm not sure about is that you indicate "This is the look in OTX both in light and dark mode.", which should NOT be the case! If macOS is in light mode (not just the OXT engine 'darkMode' preference, which applies a scripted pseudo-darkMode) then it should look exactly the same as in LC. I toggle darkMode from the OS display menu in the macOS system menubar and the IDE (home stack) receives the message and changes the IDE stack windows appearances in response.
- Screen Shot 2023-01-10 at 1.01.09 AM.png (16.56 KiB) Viewed 10267 times
Maybe there should be a separate option to 'Use macOS system appearance' and one to ignore the macOS system appearance and apply only the scripted pseudo-darkMode. OXT macOS tools can set the appearance on a per-Window basis (currently it's setting the appearance for all of the applications windows), so I could make it so that the IDE changes ONLY the IDE windows in response to the macOS-only ''systemAppearanceChanged' message but not effect any open stack document windows. See the Dictionary for the syntax. OXT macOS tools has some other nice macOS native features in it, so if you want your apps to look behave more like modern native macOS apps you should really give it a look.
To set light/dark mode at the App/Engine level:
To set light/dark mode on a per-Window basis use this syntax:
Code: Select all
setWindowToDarkMode the windowID of this stack
The handlers in the IDE Home Stack that applies system dark/light mode:
IDEToDarkMode / IDEToLightMode
It looks like the Window / macOS was still in darkMode, in the macOS system preferences (regardless of how the OXT darkMode preference is set) and/or colors in your stack may have had color properties set somewhere in the properties inheritance chain (text<-field<-group<-card<-stack<-window<-engine). I can't tell for sure because I can't see a native window frame or titlebar in your screenshot.
Also
IMPORTANT TO NOTE: the old LC default foreColor property for opaque 'classic' button
was NOT ok for use with darkMode, and so I changed a few of the default properties for several of the 'classic' controls. This is also exactly why I had to edit virtually every IDE stack to look OK in darkMode.
You stack must therefore be edited to support darkMode. The best way is to use 'empty' text color properties ( or 'use owner's color' in the IDE menu) which lets the color properties (foreColor / backColor etc.) be inherited from the Engine, which inherits colors from the OS (may be a good beginners lesson on OOP property inheritance in there somewhere).
For your preexisting stacks you would mostly just need to select any 'classic' opaque-styled buttons and set their foreColor to black, and set all text/fields foreColor/backColor to empty (reset to default) or 'use owners color', which allows most text to automatically toggle from black to white and back based on the OS appearance mode. If its a basic stack you might only need to set the fore/backColors on the card or stack level, but if you have groups within groups of controls and color props set on various parts it can be a little tricky.
For new stacks you can use the white-on-grey styled button, which is a new-'classic'-control I've added to the IDE, if you like. The old standard button now has black as the default foreColor so that they look OK in either light or dark, but keep in mind that only applies to
newly created buttons. You
could also use the macOS native buttons and native fields (widgets), which of course support macOS native darkMode, but I'm not happy with those options because they were never completed (there's hardly any properties to set) and obviously those are
not cross-platform the way the engine-drawn 'classic' objects are. I would prefer to add new 'Universal Button' and 'Universal Field' widget parts that would honor the OS theme setting and also be cross-platform.
On MacOS you can check the systemAppearance property (added to 9 engine) and then script your objects colors based on that. However 'systemAppearance' does NOT return accurate results on other operating systems, but there exists shell methods for getting system theme info (at least on Linux).
I've also added a new 'darkMode' persistent stack property which doesn't actually do anything (yet), but could be used to indicate the stack colors should be modified (by a script) depending on the current system appearance setting. My intention is to add an appearance library that handles such tasks on all the supported OSes. Windows 10 I had a problem with setting colors in the applications menus so that may need an Win-native-tools extension or engine changes to support Windows darkmode.
If you can send me the stack or a portion of it, maybe I can figure out what is going on there. I have not experienced this issue, but I've also been setting all my stacks up with darkMode in mind for some time now.