Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Create a range of solid colors for Desktop backgrounds UNIX
Mac OS X Leopard and Snow Leopard come with a paltry set of solid colors for desktop backgrounds. This is easily remedied with the ImageMagick package (available for install through both MacPorts and Fink), and a quick Terminal command.

The script below generates all the background images for web-safe colors that should then be immediately available for use in the Solid Colors section of the Desktop tab of the Desktop and Screen Saver System Preferences panel.
cd /Library/Desktop\ Pictures/Solid\ Colors; for r in 00 33 66 99 cc ff; do for g in 00 33 66 99 cc ff; do for b in 00 33 66 99 cc ff; do echo Creating image for color $r$g$b; convert -background "#$r$g$b" -page 256x256 text:- "Background $r$g$b.jpg" < /dev/null; done; done; done
You can copy and paste the script into Terminal, but you’ll need to be a system administrator for it to succeed, because it writes the images into /Library/Desktop Pictures/Solid Colors.

[robg adds: I tested this on a 10.5 machine, and it works as described. If you just have a few solid colors you want to use, you can create them yourself, as we covered in this hint. In addition, if you'd like to make it possible to use any color as your desktop background, you can create a 128x128 transparent PNG, and then use a color picker to set the color of the desktop to anything you like -- see this hint for more details.]
    •    
  • Currently 2.47 / 5
  You rated: 5 / 5 (19 votes cast)
 
[8,424 views]  

Create a range of solid colors for Desktop backgrounds | 9 comments | Create New Account
Click here to return to the 'Create a range of solid colors for Desktop backgrounds' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Create a range of solid colors for Desktop backgrounds
Authored by: jstone8 on Nov 12, '09 07:51:16AM

OK I copied and pasted the script into the Terminal, and the only thing that happened was the terminal told me three files were not found.
No asking for Admin password just that message. My question is can, will this screw up anything on my machine? Mahalo for any info, replies.



[ Reply to This | # ]
Create a range of solid colors for Desktop backgrounds
Authored by: gvitale on Nov 12, '09 08:41:09AM

You need bash. It would be helpful for if this kind of hint were given more precisely...



[ Reply to This | # ]
?
Authored by: mrmister on Nov 12, '09 11:09:07AM

Yes--I pasted in the command and nothing happened but a string of errors. If there are more steps, the hint should really be amended to reflect that.



[ Reply to This | # ]
Create a range of solid colors for Desktop backgrounds
Authored by: batalha on Nov 12, '09 01:25:12PM

The easiest way to get the solid colour you want it's by making a little 100% transparent square image. Then you save it in a folder you want. Next open Desktop & Screen Saver preference pane and add that folder, choose that image. Now you just have to change the way it appears on the Desktop. Select Center, it'll add a color button next to view mode. This button allows you to choose what colour you want from the wide System colour wheel inspector window.



[ Reply to This | # ]
Create a range of solid colors for Desktop backgrounds
Authored by: mkaz on Nov 12, '09 02:59:57PM

So how to do this with bash??



[ Reply to This | # ]
Create a range of solid colors for Desktop backgrounds
Authored by: tedw on Nov 12, '09 05:41:51PM
just because, here's an all-applescript way of tweaking out the 'transparent image' approach (and doing it with some perks):
tell application "System Events"
	set theDesktopPlist to property list file "~/Library/Preferences/com.apple.desktop.plist"
	set theGivenDesktop to property list item "displaycode" of property list item "Background" of theDesktopPlist
		-- replace 'displaycode' with the correct code for your display - see below
	try
		set theColorArray to property list item "BackgroundColor" of theGivenDesktop
	on error
		set theColorArray to make new property list item at end of property list items of theGivenDesktop with properties {kind:list, name:"BackgroundColor"}
	end try
	repeat with i from 1 to 3
		if not (exists property list item i of theColorArray) then
			make new property list item at end of property list items of theColorArray with properties {kind:number, value:random number}
		else
			set value of property list item 1 of theColorArray to random number
		end if
	end repeat
	set picture of (desktop 1) to file "path:to:transparent_image.png"
end tell
you can set this to run from the script menu, or have launchd run it periodically as you like. basically this modifies the plist file for the correct desktop using random numbers for the RGB values, and then forces the screen to update by reloading the picture. tricky points:
  • You have to figure out the display code for the display in question. the display code is a 9-16 (more or less) digit number; the only place the system makes a connection between display names and display codes is (that I've been able to find) in the invisible ~/Library/Preferences/.GlobalPreferences.plist file, though it's usually easy enough to figure out which is the correct code just by looking at ~/Library/Preferences/com.apple.desktop.plist and experimenting a little
  • You have to make sure that you create the transparent image correctly. if you use a GIF or PNG format and make sure the content is empty (not set to a neutral background color) you'll be fine. Photoshop and GIMP will both do this nicely, and I'm sure there are more lightweight graphics apps for the task as well. I used a 16x16px transparent image just to be sure it was invisible.
I've used a random number here, but it would be easy enough to set up a subroutine for more programmatic choices. the RGB numbers just need to be between 0 (no color) and 1 (full color).

[ Reply to This | # ]
Create a range of solid colors for Desktop backgrounds
Authored by: mbs on Nov 13, '09 08:54:02AM

Followed directions and created 216 web-safe colors.



[ Reply to This | # ]
Create a range of solid colors for Desktop backgrounds
Authored by: r2xman on Nov 14, '09 11:48:09AM

1. Evidently x-code has to be installed first. It can be downloaded at http://developer.apple.com/technology/Xcode.html.
2. Then install macports http://www.macports.org/install.php
3. then install imagemagick. Directions are at http://www.imagemagick.org/script/binary-releases.php#macosx. I used the first method, typing
sudo port install ImageMagick
in the terminal, and it worked fine. Never installed anything like this with the command line before. Interesting.
4. Then use the script in the hint.
Worked for me.



[ Reply to This | # ]
Why?
Authored by: Chas on Nov 15, '09 07:17:23PM

I don't understand how this hint could possibly be useful. You don't need web-safe colors on a desktop background, your desktop is not the web. And besides, web-safe colors were only useful back in the day of 8-bit video cards.



[ Reply to This | # ]