Browse the docs

darkMode

Returns 1 when the Mac is in Dark Mode, 0 when it is in Light Mode.

Keyboard Maestro: DARKMODE

Details #

darkMode() takes no arguments and returns 1 when the system appearance is Dark, otherwise 0.

Parameters #

Takes 0 arguments. {{ darkMode() }}

Examples #

darkMode()
→ 0
darkMode() ? "dark" : "light"
→ light

Gotchas #

  • It reads the system setting. A Mac set to switch appearance automatically reports whichever is showing.

  • Calling it with any argument is an error: darkMode() takes 0 arguments, got 1.

  • When no real Mac is behind it (tests, previews) or the Mac can't answer, it returns 0.