svg-icons 2.0.2.0 → 2.1.0.0
raw patch · 7 files changed
+135/−126 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
- SvgIcons.Images.Logos: haskell :: Svg
- SvgIcons.Images.Logos: logos :: [(String, Svg)]
+ SvgIcons.Icons.Coding: haskell :: Svg
+ SvgIcons.Icons.Coding: svgCoding :: [(String, Svg)]
- SvgIcons.Core.Utils: frame :: Float -> Float -> Float -> Float -> Svg
+ SvgIcons.Core.Utils: frame :: Float -> String -> Float -> Float -> Float -> Float -> Svg
Files
- src/Main.hs +7/−5
- src/SvgIcons/Core/Utils.hs +12/−5
- src/SvgIcons/Icons.hs +2/−0
- src/SvgIcons/Icons/Coding.hs +111/−0
- src/SvgIcons/Images.hs +0/−2
- src/SvgIcons/Images/Logos.hs +0/−111
- svg-icons.cabal +3/−3
src/Main.hs view
@@ -17,6 +17,7 @@ import SvgIcons.Core.Utils import SvgIcons.Icons (exampleIcons) import SvgIcons.Icons.Business (svgBusiness) +import SvgIcons.Icons.Coding (svgCoding) import SvgIcons.Icons.Computer (svgComputer) import SvgIcons.Icons.Cosmos (svgCosmos) import SvgIcons.Icons.Human (svgHuman) @@ -26,7 +27,6 @@ import SvgIcons.Icons.Textarea (svgTextarea) import SvgIcons.Icons.Tools (svgTools) import SvgIcons.Images.CountryFlags (countryFlags) -import SvgIcons.Images.Logos (logos) import SvgIcons.Images.Mosaics (mosaicSample) @@ -91,6 +91,7 @@ do createDirectory path createDirectory businessPath + createDirectory codingPath createDirectory computerPath createDirectory cosmosPath createDirectory humanPath @@ -102,6 +103,9 @@ renderSvgFiles businessPath (map fillIcons svgBusiness) renderSvgFiles businessPath (map fullIcons svgBusiness) renderSvgFiles businessPath (map strkIcons svgBusiness) + renderSvgFiles codingPath (map fillIcons svgCoding) + renderSvgFiles codingPath (map fullIcons svgCoding) + renderSvgFiles codingPath (map strkIcons svgCoding) renderSvgFiles computerPath (map fillIcons svgComputer) renderSvgFiles computerPath (map fullIcons svgComputer) renderSvgFiles computerPath (map strkIcons svgComputer) @@ -132,6 +136,7 @@ strkIcons (a,b) = (a ++ "_strk" , stdDims $ strkStyle b) -- test (a,b) = (a, coreSvg def $ b >> frame (-1) (-1) 2 2) businessPath = path ++ "business/" + codingPath = path ++ "coding/" computerPath = path ++ "computer/" cosmosPath = path ++ "cosmos/" humanPath = path ++ "human/" @@ -150,14 +155,11 @@ renderImages path = do createDirectory path createDirectory countryFlagsPath - createDirectory logosPath createDirectory mosaicsPath renderSvgFiles countryFlagsPath countryFlags - renderSvgFiles logosPath logos renderSvgFiles mosaicsPath mosaicSample where countryFlagsPath = path ++ "countryFlags/" - logosPath = path ++ "logos/" mosaicsPath = path ++ "mosaics/" @@ -179,4 +181,4 @@ , (,) "test_strk" (stdDims $ strkStyle svgFramed) ] svgFramed = - S.g $ svgTest >> frame (-1) (-1) 2 2+ S.g $ svgTest >> frame 0.05 "black" (-1) (-1) 2 2
src/SvgIcons/Core/Utils.hs view
@@ -100,18 +100,25 @@ `frame` is mainly used for testing purposes. Takes the 4 numbers of the viewbox @(x0, y0, width, height)@ -and returns a path with a very thin stroke which connects all +and returns a path which connects all consecutive corners of the viewbox and also connects opposite middle points of the sides of the viewbox.  -} -frame :: Float -> Float -> Float -> Float -> S.Svg -frame x y w h = +frame + :: Float -- ^ stroke-width + -> String -- ^ stroke color + -> Float -- ^ x0 + -> Float -- ^ y0 + -> Float -- ^ width + -> Float -- ^ height + -> S.Svg -- ^ resulting svg +frame s color x y w h = S.path ! A.fill "none" - ! A.stroke "black" - ! A.strokeWidth "0.002" + ! A.stroke (S.toValue color) + ! (A.strokeWidth .: s) ! A.d frameDirs where frameDirs = mkPath $ do
src/SvgIcons/Icons.hs view
@@ -148,6 +148,7 @@ , iconExample3 -- * Re-export all Icons modules , module SvgIcons.Icons.Business + , module SvgIcons.Icons.Coding , module SvgIcons.Icons.Computer , module SvgIcons.Icons.Cosmos , module SvgIcons.Icons.Human @@ -165,6 +166,7 @@ import SvgIcons.Core.Geometry import SvgIcons.Core.Style import SvgIcons.Icons.Business +import SvgIcons.Icons.Coding import SvgIcons.Icons.Computer import SvgIcons.Icons.Cosmos import SvgIcons.Icons.Human
+ src/SvgIcons/Icons/Coding.hs view
@@ -0,0 +1,111 @@+{-# LANGUAGE OverloadedStrings #-} + + + +module SvgIcons.Icons.Coding + ( svgCoding + , haskell + ) where + +import Text.Blaze.Svg11 ((!)) +import Text.Blaze.Svg11 as S +import Text.Blaze.Svg11.Attributes as A + +import SvgIcons.Core.Geometry +import SvgIcons.Core.Utils + + +{- | +A list with all the icons from this module, +together with appropriate names. + +svgCoding :: [ (String , S.Svg) ] +svgCoding = + [ (,) "haskell" haskell + ] +-} +svgCoding :: [ (String , S.Svg) ] +svgCoding = + [ (,) "haskell" haskell + ] + + +{- | + + + + + +-} +haskell :: Svg +haskell = + S.g + $ do + S.path + ! A.fill "#453a62" + ! A.d leftDirs + ! A.id_ "HaskellSvgIcons-haskellLogo-left" + S.path + ! A.fill "#5e5086" + ! A.d midDirs + ! A.id_ "HaskellSvgIcons-haskellLogo-mid" + S.path + ! A.fill "#8f4e8b" + ! A.d rightDirs + ! A.id_ "HaskellSvgIcons-haskellLogo-right" + where + ks = 0.112 + tx = -0.5 * ks * 17 + ty = -0.5 * ks * 12 + f x = ks * x + tx + g y = ks * y + ty + x1 = f 0 + x2 = f 3 + x3 = f 4 + x4 = f 7 + x5 = f 8 + x6 = f 9.5 + x7 = f 10.33 + x8 = f 11.66 + x9 = f 12 + x10 = f 12.33 + x11 = f 13.66 + x12 = f 15 + x13 = f 17 + y1 = g 0 + y2 = g 3.5 + y3 = g 5.5 + y4 = g 6 + y5 = g 6.5 + y6 = g 8.25 + y7 = g 8.5 + y8 = g 12 + leftDirs = mkPath $ do + m x1 y1 + l x2 y1 + l x4 y4 + l x2 y8 + l x1 y8 + l x3 y4 + S.z + midDirs = mkPath $ do + m x3 y1 + l x4 y1 + l x12 y8 + l x9 y8 + l x6 y6 + l x4 y8 + l x3 y8 + l x5 y4 + S.z + rightDirs = mkPath $ do + m x8 y3 + l x7 y2 + l x13 y2 + l x13 y3 + S.z + m x11 y7 + l x10 y5 + l x13 y5 + l x13 y7 + S.z
src/SvgIcons/Images.hs view
@@ -14,11 +14,9 @@ -} module SvgIcons.Images ( module SvgIcons.Images.CountryFlags - , module SvgIcons.Images.Logos , module SvgIcons.Images.Mosaics ) where import SvgIcons.Images.CountryFlags -import SvgIcons.Images.Logos import SvgIcons.Images.Mosaics
− src/SvgIcons/Images/Logos.hs
@@ -1,111 +0,0 @@-{-# LANGUAGE OverloadedStrings #-} - - -{- | -Module for logos. --} -module SvgIcons.Images.Logos - ( logos - , haskell - ) where - -import Text.Blaze.Svg11 ((!)) -import Text.Blaze.Svg11 as S -import Text.Blaze.Svg11.Attributes as A - -import SvgIcons.Core.Geometry -import SvgIcons.Core.Utils - - -{- | -A list with all the logos from this module, -together with appropriate names. - ->logos :: [ (String , S.Svg) ] ->logos = -> [ (,) "haskell" haskell -> ] --} -logos :: [ (String , S.Svg) ] -logos = - [ (,) "haskell" haskell - ] - - -{- | -Haskell logo - -viewbox is "0 0 17 12" - - --} -haskell :: Svg -haskell = - svg - ! A.viewbox "0 0 17 12" - ! A.height "120px" - ! A.width "170px" - $ do - S.path - ! A.fill "#453a62" - ! A.d leftDirs - ! A.id_ "HaskellSvgIcons-haskellLogo-left" - S.path - ! A.fill "#5e5086" - ! A.d midDirs - ! A.id_ "HaskellSvgIcons-haskellLogo-mid" - S.path - ! A.fill "#8f4e8b" - ! A.d rightDirs - ! A.id_ "HaskellSvgIcons-haskellLogo-right" - where - x1 = 0 - x2 = 3 - x3 = 4 - x4 = 7 - x5 = 8 - x6 = 9.5 - x7 = 10.33 - x8 = 11.66 - x9 = 12 - x10 = 12.33 - x11 = 13.66 - x12 = 15 - x13 = 17 - y1 = 0 - y2 = 3.5 - y3 = 5.5 - y4 = 6 - y5 = 6.5 - y6 = 8.25 - y7 = 8.5 - y8 = 12 - leftDirs = mkPath $ do - m x1 y1 - l x2 y1 - l x4 y4 - l x2 y8 - l x1 y8 - l x3 y4 - S.z - midDirs = mkPath $ do - m x3 y1 - l x4 y1 - l x12 y8 - l x9 y8 - l x6 y6 - l x4 y8 - l x3 y8 - l x5 y4 - S.z - rightDirs = mkPath $ do - m x8 y3 - l x7 y2 - l x13 y2 - l x13 y3 - S.z - m x11 y7 - l x10 y5 - l x13 y5 - l x13 y7 - S.z
svg-icons.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: svg-icons -version: 2.0.2.0 +version: 2.1.0.0 homepage: https://github.com/RamiroPastor/SvgIcons license: BSD-3-Clause license-file: LICENSE @@ -34,6 +34,7 @@ SvgIcons.Core.Utils, SvgIcons.Icons, SvgIcons.Icons.Business, + SvgIcons.Icons.Coding, SvgIcons.Icons.Computer, SvgIcons.Icons.Cosmos, SvgIcons.Icons.Human, @@ -45,7 +46,6 @@ SvgIcons.Images, SvgIcons.Images.CountryFlags, SvgIcons.Images.CountryFlagsCoAs, - SvgIcons.Images.Logos, SvgIcons.Images.Mosaics, Main @@ -80,6 +80,7 @@ SvgIcons.Core.Utils, SvgIcons.Icons, SvgIcons.Icons.Business, + SvgIcons.Icons.Coding, SvgIcons.Icons.Computer, SvgIcons.Icons.Cosmos, SvgIcons.Icons.Human, @@ -91,7 +92,6 @@ SvgIcons.Images, SvgIcons.Images.CountryFlags, SvgIcons.Images.CountryFlagsCoAs, - SvgIcons.Images.Logos, SvgIcons.Images.Mosaics