def test_change_color_name(): m = MTextEditor() m.color("red") assert str(m) == r"\C1;" m.clear() m.aci(0) assert str(m) == r"\C0;"
def using_colors(msp, location): attribs = dict(ATTRIBS) attribs["width"] = 10.0 editor = MTextEditor("using colors:" + NP) # Change colors by name: red, green, blue, yellow, cyan, magenta, white editor.color("red").append("RED" + NP) # The color stays the same until changed editor.append("also RED" + NP) # Change color by ACI (AutoCAD Color Index) editor.aci(3).append("GREEN" + NP) # Change color by RGB tuples editor.rgb((0, 0, 255)).append("BLUE" + NP) msp.add_mtext(str(editor), attribs).set_location(insert=location)