Toggle Dark Mode in BTT


I wrote up this quick AppleScript that can be utilized with HotKeys or a Touch Bar Button to toggle macOS Mojave's Dark Mode

tell application "System Events"
	tell appearance preferences
		get properties
		if dark mode is false then
			set dark mode to true
			set dark mode to false
		end if
	end tell
end tell

Mojave Dark Mode Activation

hey! Can I add AppleScript straight to the BTT (how?) or do I need to make the script first and then add a button that opens the ScriptEditor and run the script?


You can add it as "Run Apple Script (async in background)" but really this got deprecated because there is now a built-in "Toggle Dark Mode" option which probably works better.


Hi - I do not know how to use apple script, but came here looking for a way to toggle dark mode/light mode through a Touch Bar action. You say there's a toggle dark mode option - where? through BTT? Or is there a Mac shortcut? How can I get this to work?



I think I kind of somewhat got it. Never mind. Thanks.


Toggle Dark mode is under OSX Functionality in predefined actions. You can set it to a button or widget on Touch Bar, as a Keyboard shortcut, Trackpad gesture, etc.

If you want it to be a widget which changes icon/colour depending on whether Dark Mode is on or off, you can use this apple script:

tell application "System Events"
if dark mode of appearance preferences is false then
return "Off"
return "On"
end if
end tell


I know this is a more general question, but although I have this button in the 'global' section, it only shows up when I hit the BTT button on the control panel. Why isn't it ... globally available, always present, like the ESC "key"?


global refers to the BetterTouchTool Touchbar. BTT can not influence the system Touch Bar.