The EV3 color sensor can easily be used to follow different colored lines (e.g., red lines, green lines, blue lines). The important part about using the sensor is selecting the proper mode for following the particular colored line. For example, if the line is just a black line on a white background, then set the sensor to reflected light. However, if the line is a colored line (red/green/blue/other), then set the sensor to RGB Color mode which will output three numeric values (r, g, b). Each numeric value will range from 0% to 100% of that color. If the colored line is on a white background, then the percentages of the various colors may range from 100% to 50% or lower depending on how much of the sensor is over the line. For example, if it is a red line, then the red value from the sensor will be 100% regardless of whether the sensor is over the red line or white background. This is because the white background will generate a value of 100% for each RGB color. If the red line is over a black background, then the value for red will vary between 100% (over the red line) to 0% over the black background. So, if the line is red and the background is white, how do you follow the line since the sensor will only show 100% red? The answer is to use one of the other values from the sensor (e.g., green or blue). If the line is red and the background is white, then use the blue value from the sensor which will show 0% when over the red line and 100% when over the white background.
For example programs about using the EV3 sensors for line following, and detection and for examples about detecting colors, see: https://robotjavascript.com/line-following-examples.htm and https://robotjavascript.com/sensor-examples.htm#colorSensorValue
These examples are written in Robot JavaScript. The colorSensorValue() function returns an object with three numeric properties: { r: [0-100] , g: [0-100], b: [0-100] }
To follow the line, use the syncMotors() function and set the steering parameter to your desired sensor value: colorObject=colorSensorPct(); syncMotors(2, 3, constantPower, gain*(colorObject.b-target));
Then all you need to do is adjust the constantPower, gain, and target for your particular needs.