{-# LANGUAGE OverloadedStrings #-}
module Main where
import qualified Data.Text.Lazy as T
import qualified Data.Text.Lazy.IO as T
import Clay hiding (div,filter)
import qualified Clay as C
import Clay.Property as CP
import Clay.Filter as CF
import Control.Arrow ((>>>))
import qualified Clay.Stylesheet as CC

main :: IO ()
main = T.putStr $ renderWith compact [] $ do
  fontSetting
  codeCss
  colors

fontSetting :: Css
fontSetting = fontFace $ do
  fontFamily ["Hasklig"] []
  fontFaceSrc [FontFaceSrcUrl "../fonts/Hasklig-Medium.otf" (Just OpenType)]
  
codeCss :: Css
codeCss = pre ? do
  margin 0 10 0 $ px 10
  padding 9 9 9 $ px 9
  backgroundColor "#FDF6E3"
  border solid (px 1) (rgba 0 0 0 128)
  fontSize $ px 14
  borderRadius 5 5 5 $ px 5
  textRendering optimizeLegibility
  whiteSpace preWrap
  code ? do
    borderStyle none
    display block
    boxShadow none none none none
    fontFamily ["Hasklig", "Monaco", "Menlo"
               , "Consolas", "Courier New"] [monospace]

-- overflowWrap :: Val a => Key a -> a -> Css
-- overflowWrap = CC.key

colors :: Css
colors = star # ".sourceCode" ? do
  mapM_ (\(sel,c) -> sel ? color c) csss
  return ()
  where
    csss = 
      [ (".kw","#268BD2")
      , (".dt","#268BD2")
      , (foldr1 mappend [".dv",".bn",".fl"],"#D33682")
      , (".ch","#DC322F")
      , (".st","#2AA198")
      , (".co","#93A1A1")
      , (".ot","#A57800")
      , (".al","#CB4B16")
      , (".fu","#268BD2")
      -- , (".re","       ")
      , (".er","#D30102")]
