diff --git a/docs/syntax.md b/docs/syntax.md index cb528d3d..1074cd02 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -424,6 +424,7 @@ image: src: # path to the image file # optional parameters: caption: # text to display below the image + bgcolor: # Background color of entry in diagram component box width: # range: 1~65535; unit: points height: # range: 1~65535; unit: points # if only one dimension (width/height) is specified, the image is scaled proportionally. diff --git a/src/wireviz/DataClasses.py b/src/wireviz/DataClasses.py index cfe27247..25bbe34e 100644 --- a/src/wireviz/DataClasses.py +++ b/src/wireviz/DataClasses.py @@ -75,6 +75,7 @@ class Image: width: Optional[int] = None height: Optional[int] = None fixedsize: Optional[bool] = None + bgcolor: Optional[Color] = None # Contents of the text cell just below the image cell: caption: Optional[MultilineHypertext] = None # See also HTML doc at https://graphviz.org/doc/info/shapes.html#html diff --git a/src/wireviz/wv_gv_html.py b/src/wireviz/wv_gv_html.py index c96388e6..ecfa8985 100644 --- a/src/wireviz/wv_gv_html.py +++ b/src/wireviz/wv_gv_html.py @@ -59,11 +59,12 @@ def html_image(image): ''' - return f'''{html_line_breaks(image.caption)}' if image and image.caption else None + return (f'{html_line_breaks(image.caption)}' + if image and image.caption else None) def html_size_attr(image): from wireviz.DataClasses import Image