summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/elements/element.py6
-rw-r--r--lib/elements/fill_stitch.py6
2 files changed, 10 insertions, 2 deletions
diff --git a/lib/elements/element.py b/lib/elements/element.py
index 6b1ca47c..f1e6eb36 100644
--- a/lib/elements/element.py
+++ b/lib/elements/element.py
@@ -12,7 +12,7 @@ from typing import List, Optional
import inkex
import numpy as np
-from inkex import BaseElement, bezier
+from inkex import BaseElement, Color, bezier
from shapely import Point as ShapelyPoint
from shapely.ops import nearest_points
@@ -599,6 +599,10 @@ class EmbroideryElement(object):
stitch_plan_cache = get_stitch_plan_cache()
cache_key = self.get_cache_key(previous_stitch, next_element)
if cache_key not in stitch_plan_cache:
+ # fix up colors for cache
+ for stitch_group in stitch_groups:
+ if not isinstance(stitch_group.color, Color):
+ stitch_group.color = "black"
stitch_plan_cache[cache_key] = stitch_groups
if previous_stitch is not None:
diff --git a/lib/elements/fill_stitch.py b/lib/elements/fill_stitch.py
index 7ce3188a..3c871b8e 100644
--- a/lib/elements/fill_stitch.py
+++ b/lib/elements/fill_stitch.py
@@ -632,7 +632,11 @@ class FillStitch(EmbroideryElement):
@property
def color(self):
- return self.fill_color
+ color = self.fill_color
+ # if color is a gradient, pick the first color
+ if isinstance(color, LinearGradient):
+ color = self._get_color(color.stops[0], "stop-color", "black")
+ return color
@property
def gradient(self):