Change Color of Sprite/Image

Is it possible to change certain parts of a sprite or image into a different color? For example, I would like to create a dynamic sprite that I can use to create many different colored versions of. Would it be possible to get all the pixels of a certain color (like gray or black) and change them to a different color? I do not want to change the image color completely.

https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Pixel_manipulation_with_canvas#grayscaling_and_inverting_colors

You can use a Phaser CanvasTexture.