I haven't written any Photoshop tutorials for a while. Today I'm going to share a simple tutorial on how to create reusable background patterns with Photoshop and CSS. I learned this trick from designing WordPress themes. The trick is to create one reusable transparent PNG background and use CSS background-color property to create various color skins. It is particularly useful for creating customizable and dynamic templates (see demos).
What is so cool about this?
With transparent pattern image, users can easily customize the background color by altering the hex color.

Photoshop Trick: Extracting Pattern
This Photoshop trick works on most pattern images. For this demonstration, I'm going to use a tiled pattern image below. Follow the steps below to extract the pattern from the image. You will learn how to use Photoshop Channels to create selection.

Step 1
First you have to turn the image layer to black & white (go to Image > Adjustments > Destaturate). Then go to Image > Adjustments > Levels. Slide the: shadow, midtone, and highlight stopper to adjust the level. The goal here is to make the transparent area completely white.

Step 2
Now you should have a black & white pattern. Go to Image > Adjustments > Invert (or press Cmd + I for shortcut). Select all and copy the pattern. Go to the Channels palette, add a new Channel and then paste the pattern into the Channel layer. Remember: the white pixel in the Channel layer will be the selection.

Step 3
Go back to the Layers palette. Create a new layer. Go to Selection > Load Selection and select the Channel that you've just created in the previous step. Then fill the selection with a solid color (eg. black).

Shortcut tip for loading the Channel selection: hold down the Cmd key and click on the Channel layer thumbnail. Learn more Photoshop shortcuts here.
Opacity
To control the instensity or the darkness of the pattern, adjust the layer's opacity.

Final (see demos)
Save the final pattern as a transparent PNG file. Now you may use CSS to easily change the background color to any hex code.
.pattern {
background-image: url(pattern.png);
background-color: #666;
}
Thanx for this useful tips.
Its a good tutorial.
Cool trick. Does this work with GIF’s as well?
Good tutorial
Thank you!
Thank you
That was cool
路过踩一踩,表示我来过
支持你的博客http://www.webdesignerwall.com/
也谢谢您的回访http://nanke.zhwjyy.com/?wyxn3tj3
mena shaung
Nice technique, I really like how the user can switch colors and still get the same pattern that you’ve created for them.
I’d have to check with you here. Which is not something I usually do! I enjoy reading a post that will make people think. Also, thanks for allowing me to comment! thank you!
thanks for the tutorial. Can you tell me how to add this to my twitter page?
thanks, Andi
I use a very similar technique to this for backgrounds, but I set it up with 2 divs so that I can set the opacity on the pattern and the background color separately. It’s a bit more verbose, but a bit more flexible (which, imo, is a good tradeoff in a wordpress theme)
Beautiful Pattern.. thanks for share…
Fantastic and useful tips. The Radiolab site has one of my favorite backgrounds check it out http://browsingideas.com/radiolab-surreal-quirky-engaging/
Great tutorial. Thanks for posting. Really helpful info, clearly explained.
Combine the darkest pattern from this page with CSS background image hack: Emulating background-opacity from http://nicolasgallagher.com/css-background-image-hacks/ then you’ll get more possibilities with just a single image. :)
If you have Adobe Fireworks it’s a one step process.
Simply import your pattern and choose Filters > Other > Convert to Alpha.
This removes the white background. No pixels are harmed in the process, so you get a nice, clean, crisp transparent pattern. :)
Fireworks users may spare a few steps using Filters > Other > Convert to Alpha on the image. Very useful!
well defined and very useful..
This is great!
One extra thing that I like to do is sorta combine the “light” and “dark” versions of the pattern, so that the final image includes both black, white, and transparency.
It’s more confusing to make, but then you get a texture that has less effect on the color you tile it over. (In your demo, the “light” textures are much lighter in color than the dark ones)
Here’s the one I made: http://cl.ly/2s443k3A1o2f0d0Y2N0O
Layered over a saturated color, it changes the lightness very little, keeping the original background color more intact.
http://www.freesickwallpapers.com/
Check this out everyone Featured Wallpapers
Especially to suit your Mobile Phone!!
Cool & Useful….