added color check to linesegment & reworked color average