Flood fill
Fills a connected region of like-coloured pixels from a seed — the paint-bucket tool.
Start at one pixel, recolour it and move on to neighbours sharing the original colour; 4- or 8-connectivity decides whether diagonals count. The naive recursive version blows the stack on large areas, so scanline flood fill and queue- or stack-based versions are what people actually ship.
The same algorithm clears the board in Minesweeper, labels connected components in image analysis and marks rooms in procedurally generated levels. Simple in theory, full of edge cases in practice — above all where you draw the line on "same colour".