Yes, you can use the sobel gradient for each individual color.
If you are comfort in doing edge detection in a different method try this:
1- Specify clearly the color you want to obtain. Say a red color.
Pure red will be something like this [1,0,0]. If you are following RGB model/color system.
Where:
First value: Represents how red it is.
Second value: Represents how green it is.
Third value: Represents how blue it is.
Now if you know the exact color you want say [0.85,0.2,0.17]. That will be fine as well.
2- Specify a range. That is up to the user to pick and mostly done by trial and error and he/she gets the exact wanted color.
If your color was [0.85,0.2,0.17].
Say your range for red color is [0.9 to 0.8].
Say your range for red color is [0.25 to 0.15].
Say your range for red color is [0.22 to 0.12].
3- Now you can easily do a for loop to search in the region of interest.
The algorithm of looping will be - Search for red values that fall in the region specified, if found, search if the green pixel value falls into the specified region, and if it was found, do lastly for the blue.
Now you do realize the places of edges, you can easily manipulate and change their colors for any different purpose.
This is an easy kinda long technique for big images, but yet simple to understand.