Skip to content

Commit

Permalink
Merge pull request #4 from triplingual/master
Browse files Browse the repository at this point in the history
Colormath interface changed
  • Loading branch information
givp committed Oct 16, 2015
2 parents 92358aa + e2941b9 commit 25ae08c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions roygbiv/__init__.py
Expand Up @@ -5,7 +5,9 @@
from collections import namedtuple
from Counter import Counter
from operator import itemgetter, mul, attrgetter
from colormath.color_objects import RGBColor
from colormath.color_objects import BaseRGBColor, LabColor
from colormath.color_conversions import convert_color
import colormath.color_diff
import colorsys

Color = namedtuple('Color', ['value', 'prominence'])
Expand Down Expand Up @@ -116,7 +118,7 @@ def __autocrop(self):

def __distance(self, c1, c2):
"Calculate the visual distance between the two colors."
return RGBColor(*c1).delta_e(RGBColor(*c2), method='cmc')
return colormath.color_diff.delta_e_cmc(LabColor(*c1), LabColor(*c2))

def __meets_min_saturation(self, c, threshold):
return colorsys.rgb_to_hsv(*self.__norm_color(c.value))[1] > threshold
Expand Down

0 comments on commit 25ae08c

Please sign in to comment.