lpod.styles

class lpod.styles.odf_styles(part_name, container)

Bases: lpod.xmlpart.odf_xmlpart

get_style(family, name_or_element=None, display_name=False)

Return the style uniquely identified by the name/family pair. If the argument is already a style object, it will return it.

If the name is None, the default style is fetched.

If the name is not the internal name but the name you gave in the desktop application, set display_name to True.

Arguments:

name_or_element – unicode, odf_style or None

family – ‘paragraph’, ‘text’, ‘graphic’, ‘table’, ‘list’,
‘number’, ‘page-layout’, ‘master-page’

display_name – bool

Return: odf_style or None if not found

get_style_list(family=None, automatic=False)

Return the list of styles in the Content part, optionally limited to the given family.

Arguments:

family – str

Return: list of odf_style

lpod.styles.hex2rgb(color)

Turns a “#RRGGBB” hexadecimal color representation into a (R, G, B) tuple. Arguments:

color: str

Return: tuple

lpod.styles.rgb2hex(color)

Turns a color name or a (R, G, B) color tuple into a “#RRGGBB” hexadecimal representation. Arguments:

color – str or tuple

Return: str

Examples:

>>> rgb2hex('yellow')
'#FFFF00'
>>> rgb2hex((238, 130, 238))
'#EE82EE'