def _getHighlight(self, image, card, color='#3896f8', factor=0.3): if USE_PIL: # use semitransparent image; one for each color (PIL >= 1.1.7) if color in self._highlighted_images: shade = self._highlighted_images[color] else: shade = shadowImage(image, color, factor) self._highlighted_images[color] = shade else: # use alpha blending (PIL <= 1.1.6) if card in self._highlighted_images: shade = self._highlighted_images[card] else: shade = shadowImage(image, color, factor) self._highlighted_images[card] = shade if not shade: # we have not PIL return self.getShade() return shade