Jump to content

Yosemite Dark Mode Toggle (With Alfred Theme Toggle)


Recommended Posts

Yosemite_GUI_Mode_Toggle.png

 

DOWNLOAD: Yosemite GUI Mode Toggle Workflow

 

With either a shortcut or hotkey you can toggle between normal and dark mode in Yosemite AND thanks to the recent Alfred update, the Alfred Theme!

 

To make the workflow universal this switches between the Yosemite themes included with Alfred 2.

 

To change to your own "Normal" and "Dark" Alfred themes, be sure to modify the script lines accordingly:

 

For Normal Mode change the name:

tell application "Alfred 2" to set theme "OS X Yosemite"

For Dark Mode change the name:

tell application "Alfred 2" to set theme "OS X Yosemite Dark"
Edited by RodgerWW
Updating Link
Link to post
  • 5 weeks later...
  • 1 month later...

Very nice. I started extending this beyond Yosemite and Alfred. Here's how I added the ability to switch taskpaper themes as well:

 

1. copy your current theme (found in ~/Library/Application Support/TaskPaper/Themes/ ) to a file called current.taskpapertheme

 

2. update the AppleScript in the workflow as follows (substituting your username and your theme names (for Helvetilight-my.taskpapertheme and Helvetidark-my.taskpapertheme) in the appropriate lines):

try
	set guiMode to do shell script "defaults read -g AppleInterfaceStyle"
	tell application "System Events"
		tell appearance preferences to set dark mode to not dark mode
	end tell
	tell application "Alfred 2" to set theme "OS X Yosemite - larger type"
	do shell script "cd '/Users/yourusernamehere/Library/Application Support/TaskPaper/Themes'; cat Helvetilight-my.taskpapertheme > current.taskpapertheme"
on error
	tell application "System Events"
		tell appearance preferences to set dark mode to not dark mode
	end tell
	tell application "Alfred 2" to set theme "OS X Yosemite Dark - larger type"
	do shell script "cd '/Users/yourusernamehere/Library/Application Support/TaskPaper/Themes'; cat Helvetidark-my.taskpapertheme > current.taskpapertheme"
end try

3. after you run the Alfred workflow, quit and restart Taskpaper.  In theory, this could be done by AppleScript, but I didn't want to figure out how to check whether iit s already running, save open files, etc.

Link to post
  • 2 months later...
  • 1 year later...

My latest updates for TaskPaper 3 and OmniFocus:

	do shell script "cd '/Users/username/Library/Application Support/TaskPaper/'; cat day.less > theme.less"
	tell application "OmniFocus"
		set value of preference id "OFIColorPaletteIdentifier" to "builtin:OmniFocus Light"
	end tell

Same code but with night.less and OmniFocus Dark for night.  You need to create a day.less and night.less TP3 theme.

Link to post
  • 1 year later...
  • 2 months later...

For OmniFocus 3:

 

day:

	tell application "OmniFocus"
		set value of preference id "OFIColorPaletteIdentifier" to "default"
	end tell

night:

	tell application "OmniFocus"
		set value of preference id "OFIColorPaletteIdentifier" to "builtin:20-Dark"
	end tell

 

Link to post
  • 2 weeks later...

Great stuff @dfay!

 

 Note that it's not necessary to hardcode in hacks for these apps that now support Dark Mode natively:

 

* Things 3.7

* OmniFocus 3.1

* TaskPaper 3.8

* HazeOver 1.8

* Ulysses 14

 

Hopefully all other apps worth their salt ASAP! However, I must say conflicting times, and I personally want on a per app basis, the abililty to control Dark Mode theme support. So I may be returning to your script enhancements to override the other way soon!

Edited by sirshanksalot
Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...