Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add often used attributes for svg and path element #519

Merged
2 commits merged into from
Sep 6, 2021
Merged

Conversation

jwstegemann
Copy link
Owner

@jwstegemann jwstegemann commented Sep 6, 2021

It is now possible to craft SVG images much easier within fritz2, its element DSL now supports the <path>-Tag and the following attributes:

  • xmlns
  • fill
  • viewBox
svg {
    // quite common for each SVG declaration, so directly supported
    xmlns("http://www.w3.org/2000/svg")
    fill("none")
    viewBox("0 0 24 24")
    // too special, so no explicit wrapping function provided
    custom("circle", "opacity-25") {
        attr("cx", "12")
        attr("cy", "12")
        attr("r", "10")
        attr("stroke", "currentColor")
        attr("stroke-width", "4")
    }
    path {
        attr("fill", "currentColor")
        // `d` is explictily supported by `path` tag
        d("M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z")
    }
}

@jwstegemann jwstegemann added the enhancement New feature or request label Sep 6, 2021
@jwstegemann jwstegemann requested a review from a user September 6, 2021 12:44
@ghost ghost merged commit 6002426 into master Sep 6, 2021
@ghost ghost deleted the jwstegemann/svgPath branch September 6, 2021 14:38
@jamowei jamowei added this to the 0.12.1 milestone Sep 7, 2021
@ghost ghost added the component/styling label Sep 10, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants