One of my favorite intertidal snails is Batillaria minima, already a subject of several posts, including this one and this one. Back in 2006, I published a short paper on shell repair in Batillaria minima and its relation to the retractibility of the snail into its shell (see this post for details).
At 2 locations near Tampa, Florida where I've been studying Batillaria minima, most snails have black shells. Occasionally, there are individuals with lighter colored shells, usually with green or brown tints. I suspect the green color is contributed by the microscopic algae growing on the shells.
Usually, ~20% of shells have repaired body whorls and ordinarily, the repaired portion of a shell is black like the rest of the shell. Here are 2 such shells; in the lower shell, the repaired portion is slightly lighter with a greenish tint.
Now here is a shell in which the repaired portion of the body whorl acquired a color much lighter than the original shell.
And here is a shell in which the opposite happened: the original shell had a light brown-green color, while the repaired portion ended up with the usual black color.
Finally, here is a shell displaying a peculiar color change. Something happened while the snail was building its penultimate whorl and the shell color suddenly changed from light green to pitch black. The spire also became slightly crooked, indicating that the snail had probably suffered some injury, but survived it.
I don't know the anatomical basis of how an injury triggers a change in shell color.