Allow float degrees / percentages in color functions
This commit is contained in:
parent
6ecdef7f35
commit
27f10f25d3
|
@ -303,7 +303,7 @@ class Color():
|
|||
"""
|
||||
if color and degree:
|
||||
if isinstance(degree, str):
|
||||
degree = int(degree.strip('%'))
|
||||
degree = float(degree.strip('%'))
|
||||
h, l, s = self._hextohls(color)
|
||||
h = ((h * 360.0) + degree) % 360.0
|
||||
h = 360.0 + h if h < 0 else h
|
||||
|
@ -347,7 +347,7 @@ class Color():
|
|||
"""
|
||||
if color1 and color2:
|
||||
if isinstance(weight, str):
|
||||
weight = int(weight.strip('%'))
|
||||
weight = float(weight.strip('%'))
|
||||
weight = ((weight / 100.0) * 2) - 1
|
||||
rgb1 = self._hextorgb(color1)
|
||||
rgb2 = self._hextorgb(color2)
|
||||
|
@ -408,7 +408,7 @@ class Color():
|
|||
|
||||
def _ophsl(self, color, diff, idx, operation):
|
||||
if isinstance(diff, str):
|
||||
diff = int(diff.strip('%'))
|
||||
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)
|
||||
|
|
|
@ -164,3 +164,12 @@
|
|||
color: rgba(201,200,200,0.5);
|
||||
color: rgba(202,200,200,0.0);
|
||||
}
|
||||
.fraction {
|
||||
color: #000000;
|
||||
color: #eeeeee;
|
||||
color: #fc0002;
|
||||
color: #292f33;
|
||||
color: #2e2e2e;
|
||||
color: #005c37;
|
||||
color: #555555;
|
||||
}
|
||||
|
|
|
@ -20,3 +20,4 @@
|
|||
.vars{color:#f6430f;background-color:#f8b38d;color:#f1dfda;}
|
||||
.names{color:red;color:#0000cc;}
|
||||
.alpha{color:#c8c8c8;color:#c9c8c8;color:#cac8c8;color:#c8c9c8;color:rgba(201,200,200,0.5);color:rgba(202,200,200,0.0);}
|
||||
.fraction{color:#000000;color:#eeeeee;color:#fc0003;color:#292f33;color:#2e2e2e;color:#005c37;color:#555555;}
|
||||
|
|
|
@ -179,3 +179,12 @@
|
|||
color: rgba(201, 200, 200, 0.5);
|
||||
color: rgba(202, 200, 200, 0.0);
|
||||
}
|
||||
.fraction {
|
||||
color: darken(#29332f, 45.3%);
|
||||
color: lighten(#000, 93.5%);
|
||||
color: mix(#f00, #00f, 98.9%);
|
||||
color: spin(#29332f, 45.5);
|
||||
color: greyscale(#29332f, 98.5%);
|
||||
color: saturate(#29332f, 99.9%);
|
||||
color: desaturate(#555, 1.5%);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue