MilanoteUnofficialApi.elements.color_swatch
1from .element import Element 2from .location import Location 3from .meta import Meta 4 5 6class ColorSwatch(Element): 7 """ 8 A Milanote color swatch element. 9 """ 10 11 id: str 12 """ID of the element.""" 13 element_type: str 14 """Type of the element.""" 15 meta: Meta 16 """Metadata of the element.""" 17 location: Location 18 """Location of the element.""" 19 color: dict 20 """Color of the swatch.""" 21 text: str 22 """Text of the color swatch.""" 23 24 def __init__(self, data: dict): 25 super().__init__(data) 26 self.color = data['content']['color'] 27 self.text = "".join([block["text"] for block in data['content']['caption']['blocks']]) 28 29 def __repr__(self): 30 return f"ColorSwatch(id='{self.id}', text='{self.text}')"
7class ColorSwatch(Element): 8 """ 9 A Milanote color swatch element. 10 """ 11 12 id: str 13 """ID of the element.""" 14 element_type: str 15 """Type of the element.""" 16 meta: Meta 17 """Metadata of the element.""" 18 location: Location 19 """Location of the element.""" 20 color: dict 21 """Color of the swatch.""" 22 text: str 23 """Text of the color swatch.""" 24 25 def __init__(self, data: dict): 26 super().__init__(data) 27 self.color = data['content']['color'] 28 self.text = "".join([block["text"] for block in data['content']['caption']['blocks']]) 29 30 def __repr__(self): 31 return f"ColorSwatch(id='{self.id}', text='{self.text}')"
A Milanote color swatch element.