eliminate color transition for line whose two points have different color

Dear All,
when i set color scalar value for all line points, lines that have two different colors will have color transition effect automatically, but in my situation, i want line to be one of defined color not transition color, any good ideas how to do this?
Thanks in advance!