Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions stylecloud/stylecloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ def gen_stylecloud(
invert_mask: bool = False,
pro_icon_path: str = None,
pro_css_path: str = None,
display_image: bool = False,
):
"""Generates a stylecloud!
:param text: Input text. Best used if calling the function directly.
Expand All @@ -208,6 +209,7 @@ def gen_stylecloud(
:param invert_mask: Whether to invert the icon mask.
:param pro_icon_path: Path to Font Awesome Pro .ttf file if using FA Pro.
:param pro_css_path: Path to Font Awesome Pro .css file if using FA Pro.
:param display_image: Whether to display image after creation or not.
"""

assert any([text, file_path]), "Either text or file_path must be specified."
Expand Down Expand Up @@ -268,6 +270,10 @@ def pal_colors(word, font_size, position, orientation, random_state, **kwargs):
wc.recolor(color_func=pal_colors, random_state=random_state)
wc.to_file(output_name)

# display the image if this param is set to True
if display_image :
Image.open(output_name).show()


def stylecloud_cli(**kwargs):
"""Entrypoint for the stylecloud CLI."""
Expand Down