1. Home
  2. Mac OS X

How to change desktop wallpaper with light and dark mode on macOS Mojave

The light and dark theme on macOS are by far better than what Microsoft has on Windows 10. There aren’t any schedule features, and if you want to quickly change the mode/theme, you’re going to have to create the toggle for it yourself or install an app to do the job. If you want to change the desktop wallpaper with the light and dark mode, you can do that with a little script.

The script has a limitation though; the wallpaper that is to be applied for the light and dark mode, respectively, is pre-defined. Any time you want to change the wallpaper that is used for each mode, you’re going to have to make the change in the script.

Change desktop wallpaper with light and dark mode

Open the Script Editor on your Mac and paste the following in it.

tell application "System Events"
	
	tell appearance preferences
		
		if (dark mode) then
			set dark mode to not dark mode
			tell application "System Events"
				tell every desktop
					set picture to "path-to-folder/name-of-wallpaper-light-mode.extension"
				end tell
			end tell
		else
			set dark mode to not dark mode
				tell application "System Events"
				tell every desktop
					set picture to "path-to-folder/name-of-wallpaper-dark-mode.extension"
				end tell
			end tell
		end if
		
	end tell
	
end tell

Before you can save the script though you need to change the path to the images that will be used for the wallpapers. Replace ‘path to folder’ with the path to the folder that contains the image you want to set as the wallpaper when the light mode is set, and ‘replace ‘name-of-wallpaper-light-mode.extension’ with the name and extension of the image you want to use when the light mode is enabled.

Next, replace the second instance of ‘path to folder’ with the path to the folder that contains the image you want to use for the dark mode. Replace ‘path-to-folder/name-of-wallpaper-dark-mode.extension’ with the name of the image you want to use as the wallpaper for the dark mode.

Once you’ve made the changes, go ahead and save the script. You can run the script and it will toggle the mode. If the mode is set to light, it will switch to dark and the wallpaper will change accordingly. If the mode is already set to dark, it will switch to light and the wallpaper will change.

You can use the script as is, or you can convert the script to an app. It’s up to you how you use it. You can schedule it to run at a certain time and have both the light/dark mode change along with the wallpaper.

Leave a comment