module Data.Niagra.Properties.Color
(
color,
opacity,
hex,
rgb,
rgba
)
where
import Data.Niagra.Monad
import Data.Niagra.DSL
import Data.Niagra.Builder
import Data.Niagra.Builder.Numbers
import Data.Monoid
color :: (Monad m) => Builder -> NiagraT m ()
color = declaration "color"
opacity :: (Monad m) => Double -> NiagraT m ()
opacity = declaration "opacity" . realFloat
hex :: Integer -> Builder
hex h = singleton '#' <> hexadecimal h
rgb :: Integer -> Integer -> Integer -> Builder
rgb r g b = "rgb(" <> decimal r
<> singleton ','
<> decimal g
<> singleton ','
<> decimal b
<> singleton ')'
rgba :: Integer -> Integer -> Integer -> Double -> Builder
rgba r g b a = "rgba(" <> decimal r
<> singleton ','
<> decimal g
<> singleton ','
<> decimal b
<> singleton ','
<> realFloat a
<> singleton ')'