Automator Dark Mode issue

I mostly prefer my Finder view options set to List View but some folders I want in Icon View. So I have an Automator workflow set up as a Service so I can right-click in the Finder to change the view options to how I want them on those folders.

If you manually create a folder and set its view options to icon view in Finder, the background can be set to Default, which in Dark Mode gives a nice dark color to match the rest of the UI.

But as you can see in the Automator action pictured above, the only options there are White, Color and Picture, which were the options available in Finder before Mojave introduced Dark Mode. Clearly, Apple didn’t update the Finder’s Automator actions. You can use the color picker to set Color to the same color you get through manually changing the view options, but the icon text stays black instead of turning white as it will when you manually set the options. And there’s no way to set the text color.


The Finder’s AppleScript dictionary also doesn’t offer a solution, because again you can set the RGB values of the background but the text won’t be adjusted. And there’s apparently no way to set it to Default like you can manually.

So is there any way to automate the effect of selecting Default from the View Options window in Finder?

My current solution is to use AppleScript GUI scripting from a Keyboard Maestro macro, triggered by a key combination, but that means I need to go into each folder individually and trigger the macro… and that sucks for more than a handful of folders.

AppleScript: 2.7
Browser: Safari 605.1.15
Operating System: macOS 10.14

Have you had a look at the default Finder preferences on the command-line ? I’m on High Sierra so can’t explore on your behalf, but if you go into Terminal, and type:[format]defaults read com.apple.Finder[/format]you can scour through the various keys looking for one that sounds like it does what you want. If you don’t know how to set a key to a new value, seek some advice first because it’s easy to overwrite multiple keys without meaning to if you’re not sure what you’re doing.

No need to set Dark Mode manually. From section Utilities select action Run AppleScript and drag it under your action Set Folder Views. Code is simiar to that


on run {input, parameters}
	tell application "System Events" to tell appearance preferences
		set dark mode to not dark mode
	end tell
	return input
end run