Fill color for paint application

Hi, I am working on paint application and need help with filling colors. Users can draw any shape on the canvas, in this case how do I enable fill color. I am able to change the color if the shape doesn’t have a outline. How do I change the color of the shape with outline (outline color shouldn’t be changed)? Any help to find a solution would be appreciated. Any algorithm (simple) that can be used should be of good help. Thanks in advance