The camouflage of the gecko is very important to its survival from predators. With the gecko blending in to the tree trunk, it is less likely for a predator to see it. This gecko's coloration could have evolved in many ways. A genetic mutation would be the cause of a desired trait to be found. This trait (in this case, a mossy color), would now be a good thing for the species. This particular mutation would then be passed through generations as the geckos with this coloration had a greater chance of survival and procreation.
Work Step by Step
Mutations are the only source of new genetic traits, but patterns in the advantages or disadvantages those traits can bestow on an organism determine what happens from there. In this gecko's case, it's unlikely that a single genetic change could cause this pattern of adaptation. Over time, incrementally more adapted (camouflaged) geckos would be selected for as they were more easily able to avoid predators.