That is a very good question and im happy to know the answer to.
Like Um... already stated, the color reflective cells on an octopuses skin surface aid the octo to camouflage in the wild through whatever environment they seem to pass by. However, generally...as stated in books and a wonderful guide called "The Ultimate Guide: Octopus" on discovery, the octopuses, cuttlefish and squid see only few tones of color in terms of being color-blind: Black, white...and shades of grey. Because of these colors, they think the pattern onto their brain, chance their color precisely and know exactly how to blend in with the different shades of greys wether it be plain grey, or darker greys. In general terms, theyan only see alternated color shades of grey...which can be white and black. Through our eyes, red is the color red. In their eyes, red looks like a soft-blackish shade. Instead of changing to red...mentally, they are changing their color and pattern to the blackish shade they see in their environmment. It's very interesting.
Another interesting fact is how octopuses can change different shades of colors when their chromatophores only have pigments of black, brown, red, and yellow. The timing of the contracting and expanding of these pigment cells gives the illusion of a lot more than that. Plus, they have billions apon billions of these sacks...which would surely and easily create illusional patterns of tones not yet seen in nature. I love when they turn black. Beautiful camoulflage. They have to be the masters of camoulflage. Able to alterate skin color, texture AND shape in a fraction of a second is incredible.