Skip to content

🌈 Gradient - Tracking issue #2282

Open

Description

@Dherse

Gradient progress report:

The vast majority of those features (all of them in SVG) are available on my gradient branch. However, in this branch the layout engine is completely broken, which I have fixed in these PRs, but didn't bother to on my experimental branch.

The reason why gradients are split up is because part 1 and 2 already account for close to 5000 lines added, the size and complexity of gradients simply balloons when you consider that we support three different export targets, each with their own quirks and limitations that need to be worked around.

This is just a tracking issue I can point to in other gradient PRs ;)

Activity

  1. added
    tracking-issue
    on Oct 1, 2023
  2. changed the title [-]Gradient - Tracking issue[/-] [+]🌈 Gradient - Tracking issue[/+] on Oct 1, 2023
  3. Dherse commented on Oct 7, 2023

    @Dherse
    ContributorAuthor

    Also closes #443 (with Part 8).

  4. Dherse commented on Oct 7, 2023

    @Dherse
    ContributorAuthor

    Also closes #260. I'd even go as far as stating that it already closes it.

  5. Dherse commented on Oct 12, 2023

    @Dherse
    ContributorAuthor

    It was decided in discussion with @laurmaedje that we would not support (at least now) glyph-by-glyph gradients as they're extremely heavy file-size wise, kind of ugly, and difficult to get right.

    Starting here on Discord: https://discord.com/channels/1054443721975922748/1088371867913572452/1161943386048188436

  6. stellarpower commented on Oct 14, 2023

    @stellarpower

    This looks fab! Would building it be as simple as pointing rust to a crate from your fork? Afraid I've not much experience with the language. I would like some gradients in my document, so I can do some basic testing.

  7. laurmaedje commented on Oct 14, 2023

    @laurmaedje
    Member

    @stellarpower Most of the gradient work has already landed on main, so if you just compile Typst from main you can just use it.

  8. stellarpower commented on Oct 14, 2023

    @stellarpower

    Alright, thanks! I will just try building the master branch then.

  9. stellarpower commented on Oct 15, 2023

    @stellarpower

    As of a596663, it seems that I can fill a box with a gradient (fill can take a gradient) - but the stroke for lines doesn't seem to support this; is this worth adding as a subitem above? I imagine single straight lines ought to be a simpler starting point than arbitrary paths or font glyphs, and would enable people to take it for a spin in more situations!

  10. Dherse commented on Oct 15, 2023

    @Dherse
    ContributorAuthor

    @stellarpower With regards to line, they generally you work, you can find an example here but I generally recommend keeping simple linear gradients on line as line technically have a zero width which makes other gradient look... funky?

    I imagine single straight lines ought to be a simpler starting point than arbitrary paths or font glyphs

    Truth be told, there is essentially no difference wrt. the "complexity" of the stroke for gradient fills. Currently, gradient fills in parent mode will work on any path you throw at them, it's only when applied in relative: "self" or relative: "auto" on lines that it can get tricky.

    I should also mention that my gradient branch has the entire layout engine broken, I strongly advice not to try using it. It just contains the experimental code I have been working on since June/early July

  11. stellarpower commented on Oct 16, 2023

    @stellarpower

    Okay, so I have to do the 1pt + bit, I presume that turns it from a gradient to a stroke.

    It seems that fill accepts a gradient or a color, whilst line accepts a color or a stroke (which can be based off a gradient itself), but not a gradient.

    Thanks for the advice on your branch, I'll stay clear then.

  12. emilyyyylime commented on Oct 16, 2023

    @emilyyyylime
    Contributor

    Okay, so I have to do the 1pt + bit, I presume that turns it from a gradient to a stroke.

    Also consider stroke: (paint: gradient(..))

  13. laurmaedje commented on Oct 16, 2023

    @laurmaedje
    Member

    I think we just need to add the missing gradient -> stroke cast. Seems like an oversight.

  14. laurmaedje commented on Nov 14, 2023

    @laurmaedje
    Member

    Should we close this?

  15. Dherse commented on Nov 14, 2023

    @Dherse
    ContributorAuthor

    I was planning on working on some more features, namely pattern fills in the upcoming weeks just haven't found the motivation just yet

  16. added
    visualize
    on May 24, 2024
  17. gregzanch commented on Jan 10, 2025

    @gregzanch

    Should #5647 be included for number 9 on the list? Gradient along a path would technically solve this issue

  18. ibnz36 commented on May 22, 2025

    @ibnz36

    Hello. what's the state of Part 7? It seems to work on the preview but doesn't when exporting to a PDF.

    Code:

    #let g1 = green.transparentize(90%)
    #rect(fill: gradient.linear(blue, g1))

    Exported:

    bugtest.pdf

  19. Dherse commented on May 22, 2025

    @Dherse
    ContributorAuthor

    @ibnz36 I just updated the tracking issue with the change done in #5420 which added support for transparency gradient in PDF :)

    For any bugs please open a dedicated issue if one does not already exist.

  20. ibnz36 commented on May 22, 2025

    @ibnz36

    @Dherse Should #2546 be reopened?

  21. LaurenzV commented on May 22, 2025

    @LaurenzV
    Collaborator

    As mentioned in the issue, the fix doesn't exist in the latest Typst release yet, you need to use the current devevelopment branch if you want the fix.

  22. ibnz36 commented on May 22, 2025

    @ibnz36

    Oh, I see. Ty

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    tracking-issuevisualize

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions