kopia lustrzana https://github.com/inkstitch/inkstitch
parse unicode color names (#686)
rodzic
d9c61f4f3f
commit
8695198e21
|
|
@ -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):
|
||||
|
|
|
|||
Ładowanie…
Reference in New Issue