From 2196a889f1f2bd272d0a5325c49310aeefbaef9c Mon Sep 17 00:00:00 2001 From: Lars Yencken Date: Thu, 2 Apr 2015 18:25:56 +1100 Subject: [PATCH 1/3] Test turning saturation filter off. --- tests/test_colorific.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_colorific.py b/tests/test_colorific.py index d0fc0c3..6213a60 100644 --- a/tests/test_colorific.py +++ b/tests/test_colorific.py @@ -33,6 +33,16 @@ def test_extraction(self): found = [c.value for c in p.colors] self.assertEquals(found, expected) + def test_extraction_without_saturation_filter(self): + expected = [(0, 101, 185), + (255, 255, 255), + (187, 214, 236), + (255, 0, 0)] + p = palette.extract_colors(self.filename, min_saturation=0) + found = [c.value for c in p.colors] + self.assertEquals(found, expected) + self.assertEquals(p.bgcolor.value, (0, 0, 0)) + class ConversionTest(unittest.TestCase): def setUp(self): From f3e6455305fa6db790ca9b7ac0c00d74bf7f56f1 Mon Sep 17 00:00:00 2001 From: Lars Yencken Date: Thu, 2 Apr 2015 18:23:04 +1100 Subject: [PATCH 2/3] Allow shades with --min-saturation=0. --- colorific/palette.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/colorific/palette.py b/colorific/palette.py index 09fe25c..00ff69a 100644 --- a/colorific/palette.py +++ b/colorific/palette.py @@ -248,7 +248,7 @@ def save_palette_as_image(filename, palette): def meets_min_saturation(c, threshold): - return colorsys.rgb_to_hsv(*norm_color(c.value))[1] > threshold + return colorsys.rgb_to_hsv(*norm_color(c.value))[1] >= threshold def autocrop(im, bgcolor): From 65706520a433b9f7e54452b8f1f318863de79e83 Mon Sep 17 00:00:00 2001 From: Lars Yencken Date: Thu, 2 Apr 2015 18:27:38 +1100 Subject: [PATCH 3/3] Update the README for the fix. --- README.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.rst b/README.rst index 53b68e0..3359649 100644 --- a/README.rst +++ b/README.rst @@ -80,6 +80,11 @@ through antialiasing are not present. Changelog --------- +dev +~~~ + +- Allow shades by setting --min-saturation=0 + 0.3.0 ~~~~~