I have found a way to make the movement along the line border smoother and in speed. I will include a process to define this and will also add a code to it
First as per your room light condition, find the color sensor reading for white surface and the black line.
I found the minimum and maximum light intensity reading on my floor and the black tape. So I subtracted the minimum value reading and divided the range so that there are 3 parts to take different decision.
So my minimum reading was 13
Maximum reading was 70
So I subtracted 13 so that the value now ranges between
0 to 57
Now I divide the value by 19 to make it 3 space 0-19, 19-38 and 38-57
The mid region is the black line and it moves straight while the other two regions means moving away, I steer it accordingly to bring it back on line.
Attached is the screenshot of the code.
I hope my above finding is useful.