blaze-svg: SVG combinator library

[ bsd3, graphics, library ] [ Propose Tags ]

A blazingly fast SVG combinator library for the Haskell programming language. The Text.Blaze.SVG module is a good starting point.

Other documentation:


[Skip to Readme]

Downloads

Note: This package has metadata revisions in the cabal description newer than included in the tarball. To unpack the package including the revisions, use 'cabal get'.

Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Candidates

  • No Candidates
Versions [RSS] 0.1.0.0, 0.1.1, 0.2.0.0, 0.3.0.0, 0.3.0.1, 0.3.1.0, 0.3.3.0, 0.3.3.1, 0.3.4, 0.3.4.1, 0.3.5, 0.3.6, 0.3.6.1, 0.3.7
Change log CHANGES.md
Dependencies base (>=4 && <4.20), blaze-markup (>=0.5 && <0.9), mtl (>=2 && <2.4) [details]
License BSD-3-Clause
Author Deepak Jois
Maintainer diagrams-discuss@googlegroups.com
Revised Revision 1 made by BrentYorgey at 2024-01-30T20:03:33Z
Category Graphics
Home page https://github.com/diagrams/blaze-svg
Bug tracker http://github.com/diagrams/blaze-svg/issues
Source repo head: git clone http://github.com/diagrams/blaze-svg.git
Uploaded by BrentYorgey at 2023-06-06T15:18:49Z
Distributions Debian:0.3.6.1, LTSHaskell:0.3.7, NixOS:0.3.7, Stackage:0.3.7
Reverse Dependencies 16 direct, 55 indirect [details]
Downloads 31016 total (100 in the last 30 days)
Rating 2.0 (votes: 1) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2023-06-06 [all 1 reports]

Readme for blaze-svg-0.3.7

[back to package description]

blaze-svg uses blaze-markup to provide a SVG combinator library. blaze-markup is a fast combinator library which was derived from blaze-html.

Example Usage

Look at the examples in the Examples folder.

{-# LANGUAGE OverloadedStrings #-}
module Example where
import Text.Blaze.Svg11 ((!))
import qualified Text.Blaze.Svg11 as S
import qualified Text.Blaze.Svg11.Attributes as A
import Text.Blaze.Svg.Renderer.String (renderSvg)

main :: IO ()
main = do
  let a = renderSvg svgDoc
  putStrLn a

svgDoc :: S.Svg
svgDoc = S.docTypeSvg ! A.version "1.1" ! A.width "150" ! A.height "100" ! A.viewbox "0 0 3 2" $ do
    S.rect ! A.width "1" ! A.height "2" ! A.fill "#008d46"
    S.rect ! A.width "1" ! A.height "2" ! A.fill "#ffffff"
    S.rect ! A.width "1" ! A.height "2" ! A.fill "#d2232c"

This produces the output below (formatted for readability)

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
    "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="150" height="100" viewBox="0 0 3 2">
  <rect width="1" height="2" fill="#008d46" />
  <rect width="1" height=" 2" fill="#ffffff" />
  <rect width="1" height="2" fill="#d2232c" />
</svg>

Documentation