I think it makes a lot of sense to use Dark Mode at night, and to use Light Mode during the day. Dark is easier on the eyes at night, and light is easier to see during the day. Strangely, while Apple has a way of scheduling Night Shift, they did not think of this for Dark Mode.
I like to avoid having to install 3rd party apps for little things like this, so I figured out a way to do it with AppleScript and Calendar. Here's how.
1. Open AppleScript Editor and paste this in:
2. Go to File > Export, and change the File Format to Application. Name it "Toggle Dark Mode" and save it somewhere. This app, when run, will toggle between Dark and Light modes. You can even use this app to manually switch modes if you want.
3. Open Calendar.
4. Now we will prepare Calendar for running an app as a timed alert. This is a feature of Calendar, but for some reason it doesn't work for iCloud calendars, so we have to enable the good old "On My Mac" calendar for this. This won't interfere with your other iCloud calendars.
To do that, here's a little trick I found: Show the left Calendars pane, then select a calendar name that isn't and iCloud calendar - such as the "Birthdays" calendar.
Then right click the blank white space underneath it, and choose "New Calendar". This should create a new On My Mac calendar at the top of the list.
5. You should have a new "On My Mac" category appear, with a new calendar within it. Name it whatever you like, I called it "Scripting" as I will be using it to run scripts such as this one.
6. Create a new event for today, call it "Dark Mode On".
7. Create a Custom alert. For alert type, choose "Open File".
Point it to the "Toggle Dark Mode.app" file you created in Step 2.
Make it run "At the time of event".
Set the time of the event to when it starts to get dark.
8. Set this event to repeat daily.
9. Duplicate the event and name it "Dark Mode Off". Change its start time to when the sun rises.
10. In the left Calendar pane, uncheck the "Scripting" calendar so it doesn't clutter up your calendar. It will still work the same.
That's it. Test it out, it should work! It even runs when your Mac is sleeping (or at least it runs as soon as it wakes up).
One minor annoyance with it is that the transition from dark to light is abrupt, not smooth like when you change the appearance in System Preferences. I don't know if there's a way to make the AppleScript do that. Any ideas? But 3rd party apps don't do the transition either, so at least it's not any worse.
Another annoyance is that each time the event runs, you get a notification banner. I don't know how to have the Calendar event just run the app without there also being a notification alert. If you have any ideas, let me know!
Let me know if it works or if it doesn't, and if you have any improvements, such as disabling the notification banner and making it switch smoothly between dark and light modes!
Update: It seems that it doesn't always work while my mac is sleeping. It worked twice, but on the third try, it didn't.
I like to avoid having to install 3rd party apps for little things like this, so I figured out a way to do it with AppleScript and Calendar. Here's how.
1. Open AppleScript Editor and paste this in:
Code:
tell application "System Events"
tell appearance preferences
set dark mode to not dark mode
end tell
end tell
2. Go to File > Export, and change the File Format to Application. Name it "Toggle Dark Mode" and save it somewhere. This app, when run, will toggle between Dark and Light modes. You can even use this app to manually switch modes if you want.
3. Open Calendar.
4. Now we will prepare Calendar for running an app as a timed alert. This is a feature of Calendar, but for some reason it doesn't work for iCloud calendars, so we have to enable the good old "On My Mac" calendar for this. This won't interfere with your other iCloud calendars.
To do that, here's a little trick I found: Show the left Calendars pane, then select a calendar name that isn't and iCloud calendar - such as the "Birthdays" calendar.
Then right click the blank white space underneath it, and choose "New Calendar". This should create a new On My Mac calendar at the top of the list.
5. You should have a new "On My Mac" category appear, with a new calendar within it. Name it whatever you like, I called it "Scripting" as I will be using it to run scripts such as this one.
6. Create a new event for today, call it "Dark Mode On".
7. Create a Custom alert. For alert type, choose "Open File".
Point it to the "Toggle Dark Mode.app" file you created in Step 2.
Make it run "At the time of event".
Set the time of the event to when it starts to get dark.
8. Set this event to repeat daily.
9. Duplicate the event and name it "Dark Mode Off". Change its start time to when the sun rises.
10. In the left Calendar pane, uncheck the "Scripting" calendar so it doesn't clutter up your calendar. It will still work the same.
That's it. Test it out, it should work! It even runs when your Mac is sleeping (or at least it runs as soon as it wakes up).
One minor annoyance with it is that the transition from dark to light is abrupt, not smooth like when you change the appearance in System Preferences. I don't know if there's a way to make the AppleScript do that. Any ideas? But 3rd party apps don't do the transition either, so at least it's not any worse.
Another annoyance is that each time the event runs, you get a notification banner. I don't know how to have the Calendar event just run the app without there also being a notification alert. If you have any ideas, let me know!
Let me know if it works or if it doesn't, and if you have any improvements, such as disabling the notification banner and making it switch smoothly between dark and light modes!
Update: It seems that it doesn't always work while my mac is sleeping. It worked twice, but on the third try, it didn't.
Last edited: