def _ophsl(self, color, diff, idx, operation):
if isinstance(diff, str):
diff = float(diff.strip('%'))
hls = list(self._hextohls(color))
hls[idx] = self._clamp(operation(hls[idx], diff / 100.0))
rgb = colorsys.hls_to_rgb(*hls)
color = (utility.away_from_zero_round(c * 255) for c in rgb)
return self._rgbatohex(color)
评论列表
文章目录