Well it turns out people have been studying this. Here's a cute video of a baby octopus embryo doing the camouflage dance:
The 'chromatophores' in the title are specialized skin/pigment cells that are the key to the whole thing. Watch starting at 0:18, where you see individual cells. Inside each cell is a spot of color, like a floating drop of ink; the cell changes color by spreading out the spherical, 3-D droplet into a 2-D hexagon that fills the entire cell.
Humans don't have chromatophores, so we can't change color. Yet.