Monday, August 25, 2014

Quick tip: Detect OS X Yosemite dark mode from FileMaker

How to detect if OS X Yosemite is in "Dark Mode" from FileMaker?

Dark mode is stored in a defaults entry:  AppleInterfaceStyle
It's either "Dark" or no value.

So we just basically check if we get an error if we try to read this value.
If we get a value, we are in "Dark mode", else we're using "Normal mode".

Basic steps:

If [Abs (Get(SystemPlatform)) = 1]   //Running on OS X
    Perform AppleScript["do shell script "defaults read -g AppleInterfaceStyle""]  -  Native
      If [Get(LastError) = 0]
        Show Custom Dialog ["Dark mode!"]
      Else
        Show Custom Dialog["Normal mode!"]
      End if
End if

That's all.
You may use this to switch to a different themed layout, or to change your background color.

5 comments:

  1. Awesome tip, I'll definitely try this out when we implement our new FileMaker. Hopefully everything will run more smoothly once we have it. It would be a big load off my chest if it did! Thiago | http://www.zerobluetech.com/custom-filemaker-development/

    ReplyDelete
  2. I surprise how much effort you put to create such a great informative website. i hope you provide me such information about filemaker pro consultants in your next blog

    ReplyDelete