def outline(path, colors, precision=<NUM_LIT>, continuous=True):
<EOL>def _point_count(path, precision):<EOL><INDENT>return max(int(path.length * precision * <NUM_LIT:0.5>), <NUM_LIT:10>)<EOL><DEDENT>n = sum([_point_count(contour, precision) for contour in path.contours])<EOL>contour_i = <NUM_LIT:0><EOL>contour_n = len(path.contours) - <NUM_LIT:1><EOL>if contour_n == <NUM_LIT:0>: continuous = False<EOL>i = <NUM_LIT:0><EOL>for contour in path.contours:<EOL><INDENT>if not continuous: i = <NUM_LIT:0><EOL>j = _point_count(contour, precision)<EOL>first = True<EOL>for pt in contour.points(j):<EOL><INDENT>if first:<EOL><INDENT>first = False<EOL><DEDENT>else:<EOL><INDENT>if not continuous:<EOL><INDENT>clr = float(i) / j * len(colors)<EOL><DEDENT>else:<EOL><INDENT>clr = float(i) / n * len(colors) - <NUM_LIT:1> * contour_i / contour_n<EOL><DEDENT>_ctx.stroke(colors[int(clr)])<EOL>_ctx.line(x0, y0, pt.x, pt.y)<EOL><DEDENT>x0 = pt.x<EOL>y0 = pt.y<EOL>i += <NUM_LIT:1><EOL><DEDENT>pt = contour.point(<NUM_LIT>)  <EOL>_ctx.line(x0, y0, pt.x, pt.y)<EOL>contour_i += <NUM_LIT:1><EOL><DEDENT>
Outlines each contour in a path with the colors in the list.

Each contour starts with the first color in the list,
and ends with the last color in the list.

Because each line segment is drawn separately,
works only with corner-mode transforms.