Skin an Old Site with New Colors

Many times, the existing HTML site cannot be abandoned quickly, but updating the colors can help reinvigorate the pages.

If the code has alot of inline colors and styles, automating the recoloring makes it possible to preserve the existing investment, but still apply new colors.

Rapidly changing the colors of X-Cart's skin1.css works extremely well with X-Cart’s skin1.css. There are many colors and they map nicely with most images. There is a demo of a static image of an X-Cart home page at The colors are derived from the same image used to color this blog.

Sincere thanks to X-Cart for allowing the use of the files to support this demonstration.


If you need the JSON support functions json_encode and json_decode, but your server is not running PHP 5.2+, consider using the Zend framework.

One of the nicest things about the JSON support is that it will use json_encode and json_decode if they are available, if not, it will handle it.

Zend framework can be used as a library, so if all you need is the JSON support, you won’t incur alot of overhead.

The new version of Zend Framework includes dojo!

Change image colors with Jasc Paint Shop Pro

To take the colors from one image and apply them to another, the following approach yields the best results:

  1. Open the two images
  2. Set the focus to the target color set and save the palette. Colors > Save Palette. You may have to convert the source image to a .gif for this to work.
  3. Set the focus on the image to be recolored and load the saved palette. Colors > Load Palette

Bear in mind that if you have alot of images, you may want to pursue batch processing, either through the GUI, macros, workspace, or command line options.

This approach will probably work for any powerful image editing software, however, its success is dependent on the images and colors involved. Not all images can easily be recolored.

Comments - Etiquette

Comments are added to code to assist the reader in understanding the code. The following guidelines should be observed:

  • Comments should not be written to editorialize or entertain. Sarcasm should not be in comments. Questions can be placed in comments, where necessary, to ensure issues are identified and resolved.
  • Proper grammar and spelling are required. It reduces the opportunties for misunderstanding.
  • Comments, especially in an interpretive environment such as PHP, should be brief. Utilities that strip comments for distribution can eliminate this requirement.
  • Careful coding, with meaningful function and variable names may reduce the need for comments. Overly complex statements should be avoided.
  • Comments should be considered a visible part of the deliverable product and should be of appropriate quality. If it is a professional product, comments should be professional.
  • Comments must be updated to remain current as the code changes.