svg-icons 2.1.0.1 → 2.1.0.2
raw patch · 3 files changed
+51/−2 lines, 3 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- src/SvgIcons/Images.hs +8/−0
- src/SvgIcons/Images/Mosaics.hs +42/−1
- svg-icons.cabal +1/−1
src/SvgIcons/Images.hs view
@@ -11,6 +11,14 @@ Height to width ratios vary for every image. In particular, all flags follow their official proportions; and ratios for mosaics are specified for each mosaic. + +__Note:__ In modern browsers, nesting some @\<svg\>@ inside +another @\<svg\>@ tag DOES work, but the mechanics of the nested +viewbox and dimensions are not trivial. Do it under your own responsibility. + +To fully grasp the mosaics, check this page: + +[https://ramiropastor.es/svg-icons](https://ramiropastor.es/svg-icons) -} module SvgIcons.Images ( module SvgIcons.Images.CountryFlags
src/SvgIcons/Images/Mosaics.hs view
@@ -15,6 +15,10 @@ * To build a perfectly matching mosaic, you must respect the width-to-height ratio (specific for every tile function), otherwise the resulting will have undesired gaps inbetween. + +To fully grasp the potential, check this page: + +[https://ramiropastor.es/svg-icons](https://ramiropastor.es/svg-icons) -} module SvgIcons.Images.Mosaics ( mosaicSample @@ -60,6 +64,7 @@ > , (,) "wiresMosaic" (wiresMosaic "gray") > , (,) "curvesMosaic" curvesMosaic > , (,) "airplaneMosaic" (airplaneMosaic "deepskyblue") +> , (,) "octagonsMosaic" (octagonsMosaic "lightgray" "chocolate") > ] -} mosaicSample :: [ (String , S.Svg) ] @@ -76,6 +81,7 @@ , (,) "wiresMosaic" (wiresMosaic "gray") , (,) "curvesMosaic" curvesMosaic , (,) "airplaneMosaic" (airplaneMosaic "deepskyblue") + , (,) "octagonsMosaic" (octagonsMosaic "lightgray" "chocolate") ] @@ -358,7 +364,7 @@ {- |  -Ratio between width and height is: \(h = 0.85 \cdot w\) +Ratio between width and height is: \(w = 0.85 \cdot h\) -} lemonsMosaic :: String -> Svg lemonsMosaic fillColor = @@ -1020,3 +1026,38 @@ aa r1 r1 0 False False 0.5 1 aa r1 r1 0 False False 0 y1 S.z + + + +{- | + + +Ratio between width and height is: \(h = w\) +-} +octagonsMosaic :: String -> String -> Svg +octagonsMosaic fillColor strkColor = + svg + ! A.viewbox "0 0 4 4" + ! A.height "300px" + ! A.width "300px" + $ do + S.path + ! A.strokeWidth "0.2" + ! A.stroke (S.toValue strkColor) + ! A.fill (S.toValue fillColor) + ! A.d dirs + where + dirs = mkPath $ do + m 1 1 + l 3 1 + l 3 3 + l 1 3 + S.z + m 1 1 + l 0 0 + m 3 3 + l 4 4 + m 3 1 + l 4 0 + m 1 3 + l 0 4
svg-icons.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: svg-icons -version: 2.1.0.1 +version: 2.1.0.2 homepage: https://github.com/RamiroPastor/SvgIcons license: BSD-3-Clause license-file: LICENSE