It depends on how many colors you need to detect. If you only need to recognize a few basic colors, simple comparison (as in my previous comment) will do. If you need lots of colors, you can find color tables in google, here are a few examples:
http://chir.ag/projects/name-that-color/#6195ED
https://cloford.com/resources/colours/500col.htm
Of course, you can't compare the rgb value directly, you need to find the nearest in the database.
.
Color detection should work the same way with mouse and touch. Maybe you are placing the Canvas object wrong on tap? Make it bigger than 1px and after reading r g b values fill the Canvas with some bright color, so that you'll see where it is.
I used the get webcam example from construct 2 and followed the code you guided. On desktop it is quite ok but not accurate on mobile not satisfactorily. You can try it on mobile.
vserv-images.s3.amazonaws.com/adsunit/webcamcolordetect/trackcolor/index.html