Change similar pixels with the Magic Eraser tool
When you click in a layer with the Magic Eraser tool, the tool changes all similar pixels to transparent. If you’re working in a layer with locked transparency, the pixels change to the background color. If you click in the background, it is converted to a layer and all similar pixels change to transparent.
You can choose to erase contiguous pixels only or all similar pixels on the current layer.