Set Line Color before drawing/creating the line

When I draw or create a line, it uses by default the last used color. How can I set programmatically this color, before I draw/create the line?

can't
Thanks WHRoeder!