Skip to content

Commit 88076ca

Browse files
committed
fix: gradient order
1 parent 249b46b commit 88076ca

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/core/elements.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,10 @@ export function Gradient(id: string, colors: Record<string, string>, ratio = 0)
290290
x2: Math.round(Math.cos(ratio) * 100) / 100,
291291
y2: Math.round(Math.sin(ratio) * 100) / 100,
292292
},
293-
children: Object.entries(colors).map(([offset, color]) => {
294-
return new Item("stop", { attr: { offset, "stop-color": color } });
295-
}),
293+
children: Object.entries(colors)
294+
.sort((a, b) => a[0].localeCompare(b[0]))
295+
.map(([offset, color]) => {
296+
return new Item("stop", { attr: { offset, "stop-color": color } });
297+
}),
296298
});
297299
}

0 commit comments

Comments
 (0)