def line_edit_style_factory(txt_color='white', tgt_layer_color='white',
                            bg_color='#232323'):
    """Generates a string of a qss style sheet for a line edit. Colors can be
    supplied as strings of color name or hex value. If a color arg receives
    a tuple we assume it is either an rgb or rgba tuple.
    :param txt_color: Color the text of the line edit should be.
    :param tgt_layer_color: The color of the current target layer.
    :param bg_color: The color that will fill the background of the line eidit.
    :return: string of qss
    """

    def handle_rgb(color_tuple):
        """Assumes the tuple is rgba or rgb (len 4 or 3)"""
        val = ','.join([str(i) for i in color_tuple])
        if len(color_tuple) == 4:
            rgb = 'rgba({})'.format(val)
        else:
            rgb = 'rgb({})'.format(val)
        return rgb
    if isinstance(bg_color, tuple):
        bg_color = handle_rgb(bg_color)
    style = '''
                QTextEdit,
                QLineEdit {
                    border-radius: 11px;
                    border: 1px solid transparent;
                    background-color: %s;
                    color: %s
                }

                QTextEdit:hover,
                QLineEdit:hover {
                    border: 1px solid %s
                }

                QTextEdit:focus,
                QLineEdit:focus {
                    border: 2px solid %s
                }
                ''' % (bg_color, txt_color, tgt_layer_color,
                       tgt_layer_color)
    return style