diff options
| -rw-r--r-- | lib/threads/color.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/threads/color.py b/lib/threads/color.py index ea9dab06..e24856a9 100644 --- a/lib/threads/color.py +++ b/lib/threads/color.py @@ -1,8 +1,10 @@ import colorsys -from pyembroidery.EmbThread import EmbThread import re +import tinycss2.color3 + import simplestyle +from pyembroidery.EmbThread import EmbThread class ThreadColor(object): @@ -17,6 +19,10 @@ class ThreadColor(object): self.manufacturer = color.brand self.rgb = (color.get_red(), color.get_green(), color.get_blue()) return + elif isinstance(color, unicode): + self.rgb = tinycss2.color3.parse_color(color) + # remove alpha channel and multiply with 255 + self.rgb = tuple(channel * 255.0 for channel in list(self.rgb)[:-1]) elif isinstance(color, (list, tuple)): self.rgb = tuple(color) elif self.hex_str_re.match(color): |
