I've monkey patched the gradient add method to keep the order, and I confirm it works.
def monkey_patch_gradient_add(self, stop):
# If no offset given, add as is
if stop["offset"] is None:
self.elements.append(stop)
return
# Add before the first bigger offset
for (i, elem) in enumerate(self.elements):
if elem["offset"] is None:
continue
if elem["offset"] > stop["offset"]:
self.elements.insert(i, stop)
return
# If no bigger found, add at the end
self.elements.append(stop)
_AbstractGradient.add = monkey_patch_gradient_add
The following code will make a red to blue gradient, ignoring the green gradient stop with offset 0.5
I've monkey patched the gradient add method to keep the order, and I confirm it works.