Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"@shuding/opentype.js": "1.4.0-beta.0",
"css-background-parser": "^0.1.0",
"css-box-shadow": "1.0.0-3",
"css-gradient-parser": "^0.0.16",
"css-gradient-parser": "^0.0.17",
"css-to-react-native": "^3.0.0",
"emoji-regex-xs": "^2.0.1",
"escape-html": "^1.0.3",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions src/builder/gradient/radial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ function calcRadialGradient(
xDelta,
style,
true
) || xDelta / 2
) ?? xDelta / 2
}

if (cy.type === 'keyword') {
Expand All @@ -169,7 +169,7 @@ function calcRadialGradient(
yDelta,
style,
true
) || yDelta / 2
) ?? yDelta / 2
}

return pos
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions test/gradient.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,26 @@ describe('Gradient', () => {
expect(toImage(svg, 100)).toMatchImageSnapshot()
})

it('should make sense if x of y is zero', async () => {
const svg = await satori(
<div
style={{
backgroundColor: 'white',
backgroundImage: 'radial-gradient(circle at 0px 0%, blue, red)',
backgroundSize: '100px 100px',
height: '100%',
width: '100%',
}}
></div>,
{
width: 100,
height: 100,
fonts,
}
)
expect(toImage(svg, 100)).toMatchImageSnapshot()
})

it('should support radial-gradient with unspecified <ending-shape>', async () => {
const svg = await satori(
<div
Expand Down
Loading