diff --git a/test/test_wordcloud_cli.py b/test/test_wordcloud_cli.py index f4f79d0c5..a228c3990 100644 --- a/test/test_wordcloud_cli.py +++ b/test/test_wordcloud_cli.py @@ -122,11 +122,6 @@ def test_check_duplicate_color_error(tmpdir, tmp_text_file): cli.parse_args(['--color', 'red', '--colormask', str(color_mask_file), '--text', str(tmp_text_file)]) -def test_parse_args_defaults_to_random_color(tmp_text_file): - args, text, image_file = cli.parse_args(['--text', str(tmp_text_file)]) - assert args['color_func'] == wc.random_color_func - - def test_unicode_text_file(): unicode_file = os.path.join(os.path.dirname(__file__), "unicode_text.txt") args, text, image_file = cli.parse_args(['--text', unicode_file]) diff --git a/wordcloud/__init__.py b/wordcloud/__init__.py index 5b7b4e9db..3ec29977c 100644 --- a/wordcloud/__init__.py +++ b/wordcloud/__init__.py @@ -1,8 +1,8 @@ -from .wordcloud import (WordCloud, STOPWORDS, random_color_func, +from .wordcloud import (WordCloud, STOPWORDS, random_color_func, colormap_color_func, get_single_color_func) from .color_from_image import ImageColorGenerator -__all__ = ['WordCloud', 'STOPWORDS', 'random_color_func', +__all__ = ['WordCloud', 'STOPWORDS', 'random_color_func', 'colormap_color_func', 'get_single_color_func', 'ImageColorGenerator', '__version__'] diff --git a/wordcloud/wordcloud_cli.py b/wordcloud/wordcloud_cli.py index 4ddd3db4f..a81a82c66 100644 --- a/wordcloud/wordcloud_cli.py +++ b/wordcloud/wordcloud_cli.py @@ -242,9 +242,9 @@ def parse_args(arguments): mask = args.pop('mask') args['mask'] = np.array(Image.open(mask)) - color_func = wc.random_color_func colormask = args.pop('colormask') color = args.pop('color') + color_func = wc.colormap_color_func(args['colormap']) if colormask: image = np.array(Image.open(colormask)) color_func = wc.ImageColorGenerator(image)