def strip_transparency(self, color, track_darkness=False): if color is None: return color ba = "AA" rgba = RGBA(color.replace(" ", "")) rgba.apply_alpha(self.bground + ba if self.bground != "" else "#FFFFFF%s" % ba) return rgba.get_rgb()
def strip_transparency(self, color, track_darkness=False, simple_strip=False): if color is None: return color rgba = RGBA(color.replace(" ", "")) if not simple_strip: rgba.apply_alpha(self.bground if self.bground != "" else "#FFFFFF") return rgba.get_rgb()
def strip_transparency(self, color, track_darkness=False, simple_strip=False): if color is None: return color rgba = RGBA(color.replace(" ", "")) if not simple_strip: rgba.apply_alpha(self.bground if self.bground != "" else "#FFFFFF") if track_darkness: lumens = rgba.luminance() if self.dark_lumens is None or lumens < self.dark_lumens: self.dark_lumens = lumens return rgba.get_rgb()
def strip_transparency(self, color, track_darkness=False): if color is None: return color ba = "AA" rgba = RGBA(color.replace(" ", "")) rgba.apply_alpha(self.bground + ba if self.bground != "" else "#FFFFFF%s" % ba) if track_darkness: lumens = rgba.luminance() if self.dark_lumens is None or lumens < self.dark_lumens: self.dark_lumens = lumens return rgba.get_rgb()
def strip_transparency(self, color, track_darkness=False, simple_strip=False): if color is None: return color rgba = RGBA(color.replace(" ", "")) if not simple_strip: rgba.apply_alpha(self.bground if self.bground != "" else "#FFFFFF") if track_darkness: lumens = rgba.luminance() if self.dark_lumens is None or lumens < self.dark_lumens: self.dark_lumens = lumens return rgba.get_rgb()
def apply_color_change(self, color, shift_factor): rgba = RGBA(color) if shift_factor is not None: rgba.brightness(shift_factor) return rgba.get_rgb()
def filter_color(color): rgba = RGBA(color) for f in self.filter: name = f[0] value = f[1] if name == "grayscale": rgba.grayscale() elif name == "sepia": rgba.sepia() elif name == "saturation": rgba.saturation(value) elif name == "invert": rgba.invert() elif name == "brightness": rgba.brightness(value) elif name == "hue": rgba.hue(value) elif name == "colorize": rgba.colorize(value) return rgba.get_rgba()
def filter_color(color): rgba = RGBA(color) for f in self.filter: name = f[0] value = f[1] if name == "grayscale": rgba.grayscale() elif name == "sepia": rgba.sepia() elif name == "saturation": rgba.saturation(value) elif name == "invert": rgba.invert() elif name == "brightness": rgba.brightness(value) elif name == "hue": rgba.hue(value) elif name == "colorize": rgba.colorize(value) return rgba.get_rgba()
def apply_color_change(self, color, shift_factor): rgba = RGBA(color) if shift_factor is not None: rgba.brightness(shift_factor) return rgba.get_rgb()