Skip to content

Gradient Part 2a - Fix sharp gradients in SVG#2307

Merged
laurmaedje merged 2 commits intotypst:mainfrom
Dherse:gradient-linear-fix
Oct 4, 2023
Merged

Gradient Part 2a - Fix sharp gradients in SVG#2307
laurmaedje merged 2 commits intotypst:mainfrom
Dherse:gradient-linear-fix

Conversation

@Dherse
Copy link
Contributor

@Dherse Dherse commented Oct 3, 2023

Tracking issue: #2282

This fixes sharp gradients in SVG export as well as adding a test for the smoothness argument on gradient.sharp.

I have also noticed the following on which I would like your opinion: hue gradients (so gradients that involve hue rotations) can be... tricky, in some cases such as:

gradient.linear(
  color.hsl(0deg, 100%, 50%),
  color.hsl(359deg, 100%, 50%),
  color.hsl(0deg, 100%, 50%),
  relative: "parent",
  space: color.hsl
)

Will render as:
image

This is because it sees the part 0 -> 359 degrees as being a change of color, but the 359 -> 0 degrees as also being an increase, but so small that the color difference is literally zero. I was wondering whether I should annotate the doc to say that hsv and hsl gradients should use increase hue, or whether we could try and support this better? There is already a lot of code specifically for hsv and hsl gradients and I don't want to add potentially a lot, does anybody know how (others?) to handle that nicely?

Edit

As discussed on Discord, we will implement the ability to choose how to do hue interpolation, but that will be in part 6 as per #2282

@Dherse Dherse mentioned this pull request Oct 3, 2023
13 tasks
@Dherse
Copy link
Contributor Author

Dherse commented Oct 4, 2023

@laurmaedje as @reknih and I discussed hue interpolation this morning on Discord, you can merge this as long as it passes your code review.

@laurmaedje laurmaedje merged commit 57bc614 into typst:main Oct 4, 2023
@laurmaedje
Copy link
Member

Thanks!

@Dherse Dherse deleted the gradient-linear-fix branch October 4, 2023 09:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants