Continuing with the extremely long(and tiring) process of detecting colors, I have finally found the solution to it. Last time I had so many loops that the program got confused. Now I kept it fairly simple with only two colors and one loop. I made it so that the color sensor would be constantly checking for the color blue by going to the left. When the color sensor detects the blue it would move to the right and restart the loop. So now the robot will follow the edge of the two mats until it doesn't see blue anymore.
This has set the foundation for my understanding of the color sensor. Now I can use it properly in more advanced programs.
Follow the Edge from Ishaan Jain on Vimeo.