Chameleons are interesting creatures that change color based on their mood or as a territorial signal, light, or temperature, not to blend in with their environment. This change actually occurs on a microscopic level through cells called chromatophores. Several creatures other than chameleons are use of chromatophores such as cuddlefish and octopuses. The for a cuddle fish its body actually contains several colors; its skin is made-up of several layers of chromatophores with each layer containing a single pigment. Each chromatophore is surrounded by a circular muscle that can constrict or expand. When the muscle constricts, pigment goes to the top of the chromatophore and the cell becomes a wide, flat disc. Upon relaxation, the cell is a small spot, which is difficult to detect. The color of the body is based on which pigments are being constricted at a certain time.
Here are a few links of interest:
http://phys.org/news/2013-05-chameleons-creatures-colour.html (This link contains a video of an octopus and how they change color. Of interesting note is an octopus only uses a few patterns to blend in with its environment. )
The picture of the chameleon on the left and a cuddle fish on the right.
Color Change in Fish or Frog Melanophore Cell (A melanophore is a chromatophore that contains black melanin pigment.)
Left: Muscle fibers expand and contract the chromatophore
Right: As different patches expand and contract, the skin of the squid changes color