Change line() color in a nested while-loop

Sorry about that. I am used to the fact that I sometimes do not get a response on 1 site, which makes me inclined to post it on another for good meassure.

When i got my first answer on stackoverflow, it unfortunately wasnt the answer I could use (actual javascript and not P5) and later on got the answer here before others started to comment i believe.

But wont happen again. Will stick it to 1 post at a time.