Set Desktop to a Color?

musat
Contributor III

Hello,
We have some loaner computers that we give to students when their Mac is out for repair. I see in the "Restrictions" Configuration Profile the option to lock the wallpaper to a particular file. Is there a way to instead set the desktop to a color? I know I can set the desktop to a color via System Preferences, but is there a way to do that by script?

4 REPLIES 4

iMatthewCM
Contributor II
Contributor II

Hey @musat , I think this should do what you want:

sudo osascript -e 'tell application "Finder" to set desktop picture to POSIX file "/Library/Desktop Pictures/Solid Colors/Solid Gray Dark.png"'

You can look through that /Library/Desktop Pictures/Solid Colors/ folder to see what other solid color options are available. (They're the same ones listed in System Preferences)

Not sure about setting a custom color. I see that as an option in System Preferences, but I can't figure out the syntax. The first comment here seems to be circling it: [http://apple.stackexchange.com/questions/40644/how-do-i-change-desktop-background-with-a-terminal-command](link URL)

musat
Contributor III

Yeah, we were hoping to be able to set the desktop to a custom color. They are wanting to set the background to some fairly annoying color so that students don't just keep using the loaner and never finish the process for repairing their Mac.

SeanA
Contributor III

Why not create a file ("annoying_color") with that customer color, save it as .jpg (or whatever format works for you), and lock the wallpaper to the "annoying_color" file using said Configuration Profile?

iMatthewCM
Contributor II
Contributor II

I agree with @SeanA , that was going to be my follow up :) Well said! Then we skip the script altogether. Deploy a package with that jpg in it, scope the Config Profile only to machines that have installed that package?