diff options
| author | Kaalleen <36401965+kaalleen@users.noreply.github.com> | 2025-07-11 22:14:52 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-11 22:14:52 +0200 |
| commit | 2235ec6571601e12be7eb3c74907668fb68bebd4 (patch) | |
| tree | 61d85cb615a1b2327283e89f09592e1eb85ad91c /lib/stitches/linear_gradient_fill.py | |
| parent | 7bd72274780ccaeae8bbae6e761341079df21ecb (diff) | |
Fix issue with bad color names (#3816)
* fix issue with bad color names and define element colors at one place and reuse
* fix bad tartan color
* verify color in gradient block
* add thread color tests
* use default color behavior for elements linked to non-existing definitions (gradients)
* Added mypy change for tests (authored by: CapellanCitizen)
Diffstat (limited to 'lib/stitches/linear_gradient_fill.py')
| -rw-r--r-- | lib/stitches/linear_gradient_fill.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/stitches/linear_gradient_fill.py b/lib/stitches/linear_gradient_fill.py index 2fb03bf9..589a1f23 100644 --- a/lib/stitches/linear_gradient_fill.py +++ b/lib/stitches/linear_gradient_fill.py @@ -6,7 +6,7 @@ from math import ceil, floor, sqrt import numpy as np -from inkex import DirectedLineSegment, Transform +from inkex import Color, ColorError, DirectedLineSegment, Transform from networkx import is_empty from shapely import segmentize from shapely.affinity import rotate @@ -75,7 +75,10 @@ def _get_gradient_info(fill, bbox): # but inkex/tinycss fails on stop color styles when it is not in the style attribute, but in it's own stop-color attribute colors = [] for i, stop in enumerate(fill.gradient.stops): - color = stop.get_computed_style('stop-color') + try: + color = stop.get_computed_style('stop-color') + except ColorError: + color = Color('black') opacity = stop.get_computed_style('stop-opacity') if float(opacity) == 0: color = 'none' |
