diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2025-04-26 06:05:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-26 06:05:12 +0200 |
| commit | 4cfb02c370e2f09d59658f652c4b15bd41d46d6e (patch) | |
| tree | 3116c9a8b723f10f90b6819b624360e0f48d0d05 | |
| parent | b30395b73c88eeb7f04214214c31d7a229167408 (diff) | |
add icc color workaround (#3687)
| -rw-r--r-- | lib/threads/color.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/threads/color.py b/lib/threads/color.py index ef655045..26da78d5 100644 --- a/lib/threads/color.py +++ b/lib/threads/color.py @@ -5,7 +5,7 @@ import colorsys -from inkex import Color +from inkex import Color, ColorCMS from pyembroidery.EmbThread import EmbThread @@ -33,6 +33,11 @@ class ThreadColor(object): self.rgb = (color.get_red(), color.get_green(), color.get_blue()) return elif isinstance(color, str): + # This will catch icc colors which cannot be parsed as rgb colors directly + if isinstance(Color(color), ColorCMS): + # The icc color has a hex color prepended. + # The easiest way to receive a color value is therefore to just use the hex color from the front. + color = color.split()[0] self.rgb = tuple(Color(color).to('rgb').get_values(False)) elif isinstance(color, (list, tuple)): self.rgb = tuple(color) |
