Strongly typed styles
Closed this issue · 1 comments
Kobzol commented
Style object:
class Style:
def __init__(attrs):
self.attrs = attrs # can be replaced by self.bold, self.color to be fully typed
def update(self, **kwargs):
attrs = dict(self.attrs)
attrs.update(kwargs)
return Style(attrs)
Creation of style:
style = Style(bold=True)
Change style:
new_style = style.update(size=32)
Default styles + update:
code = slide.style.code()
slide.style.update(code, code.update(bold=True))
Using style:
style = slide.style.default().update(bold=True)
box.text("hello", style=style)
Usage in text:
box.text("hello ~emph{world} ~mystyle{!}", style=style1,
inline_styles=dict(emph=slide.styles.emph(), mystyle=mystyle))
spirali commented
Implemented in v2.0 as TextStyles