{-# LANGUAGE     OverloadedStrings       #-}



module Core.Style 
  ( stdDims
  , strkStyle
  , fillStyle
  , fullStyle
  ) where

import           Text.Blaze.Svg11 ((!))
import qualified Text.Blaze.Svg11 as S
import qualified Text.Blaze.Svg11.Attributes as A




{- |
`stdDims` takes some svg content and wraps it with the
`svg` tag, with attributes @viewbox="-1 -1 2 2"@, @height="300px"@
and @width="300px"@ 
-}
stdDims :: S.Svg -> S.Svg
stdDims :: Svg -> Svg
stdDims Svg
content =
  Svg -> Svg
S.svg Svg
content
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.viewbox AttributeValue
"-1 -1 2 2"
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.height  AttributeValue
"100px"
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.width   AttributeValue
"100px"



{- |
Handy shortcut for the following attributes:
* @fill="none"@
* @stroke="black"@
* @stroke-width="0.04"@
-}
strkStyle :: S.Svg -> S.Svg
strkStyle :: Svg -> Svg
strkStyle Svg
svg =
  Svg
svg
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.fill        AttributeValue
"none"
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.stroke      AttributeValue
"black"
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.strokeWidth AttributeValue
"0.04"



{- |
Handy shortcut for the following attributes:
* @fill="black"@
* @stroke="none"@
* @stroke-width="0"@
-}
fillStyle :: S.Svg -> S.Svg
fillStyle :: Svg -> Svg
fillStyle Svg
svg =
  Svg
svg
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.fill        AttributeValue
"black"
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.stroke      AttributeValue
"none"
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.strokeWidth AttributeValue
"0"



{- |
Handy shortcut for the following attributes:
* @fill="silver"@
* @stroke="black"@
* @stroke-width="0.03"@
-}
fullStyle :: S.Svg -> S.Svg
fullStyle :: Svg -> Svg
fullStyle Svg
svg =
  Svg
svg
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.fill        AttributeValue
"silver"
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.stroke      AttributeValue
"black"
    forall h. Attributable h => h -> Attribute -> h
! AttributeValue -> Attribute
A.strokeWidth AttributeValue
"0.03"