(value)
return outline_dict
Parse outline string into a dictionary of outline properties.

    The font CSS property is a shorthand for outline-style, outline-width, and outline-color.

    Reference:
    - https://www.w3.org/TR/2011/REC-CSS2-20110607/ui.html#dynamic-outlines
    - https://developer.mozilla.org/en-US/docs/Web/CSS/outline
Parse outline string into a dictionary of outline properties.
Parse outline string into a dictionary of outline properties .
def outline(value):
    """
    Parse outline string into a dictionary of outline properties.

    The font CSS property is a shorthand for outline-style, outline-width, and outline-color.

    Reference:
    - https://www.w3.org/TR/2011/REC-CSS2-20110607/ui.html#dynamic-outlines
    - https://developer.mozilla.org/en-US/docs/Web/CSS/outline
    """
    if value:
        if isinstance(value, str):
            values = [val.strip() for val in value.split()]
        elif isinstance(value, Sequence):
            values = value
        else:
            raise ValueError('Unknown outline %s ' % value)
    else:
        raise ValueError('Unknown outline %s ' % value)

    # We iteratively split by the first left hand space found and try to validate if that part
    # is a valid <outline-style> or <outline-color> or <ourline-width> (which can come in any order)

    # We use this dictionary to store parsed values and check that values properties are not
    # duplicated
    outline_dict = {}
    for idx, part in enumerate(values):
        if idx > 2:
            # Outline can have a maximum of 3 parts
            raise ValueError('Outline property shorthand contains too many parts!')

        outline_dict = _parse_outline_property_part(part, outline_dict)

    return outline_dict
def outline ( value ) : if value : if isinstance ( value , str ) : values = [ val . strip ( ) for val in value . split ( ) ] elif isinstance ( value , Sequence ) : values = value else : raise ValueError ( 'Unknown outline %s ' % value ) else : raise ValueError ( 'Unknown outline %s ' % value ) # We iteratively split by the first left hand space found and try to validate if that part # is a valid <outline-style> or <outline-color> or <ourline-width> (which can come in any order) # We use this dictionary to store parsed values and check that values properties are not # duplicated outline_dict = { } for idx , part in enumerate ( values ) : if idx > 2 : # Outline can have a maximum of 3 parts raise ValueError ( 'Outline property shorthand contains too many parts!' ) outline_dict = _parse_outline_property_part ( part , outline_dict ) return outline_dict