def text_to_qcolor(text):
color = QColor()<EOL>if not is_string(text): <EOL><INDENT>text = str(text)<EOL><DEDENT>if not is_text_string(text):<EOL><INDENT>return color<EOL><DEDENT>if text.startswith('<STR_LIT:#>') and len(text)==<NUM_LIT:7>:<EOL><INDENT>correct = '<STR_LIT>'<EOL>for char in text:<EOL><INDENT>if char.lower() not in correct:<EOL><INDENT>return color<EOL><DEDENT><DEDENT><DEDENT>elif text not in list(QColor.colorNames()):<EOL><INDENT>return color<EOL><DEDENT>color.setNamedColor(text)<EOL>return color<EOL>
Create a QColor from specified string
Avoid warning from Qt when an invalid QColor is instantiated