module Brick.Util
( clamp
, on
, fg
, bg
, style
, clOffset
)
where
#if !(MIN_VERSION_base(4,11,0))
import Data.Monoid ((<>))
#endif
import Graphics.Vty
import Brick.Types.Internal (clOffset)
clamp :: (Ord a)
=> a
-> a
-> a
-> a
clamp :: forall a. Ord a => a -> a -> a -> a
clamp a
mn a
mx a
val = a -> a -> a
forall a. Ord a => a -> a -> a
max a
mn (a -> a -> a
forall a. Ord a => a -> a -> a
min a
val a
mx)
on :: Color
-> Color
-> Attr
on :: Color -> Color -> Attr
on Color
f Color
b = Attr
defAttr Attr -> Color -> Attr
`withForeColor` Color
f
Attr -> Color -> Attr
`withBackColor` Color
b
fg :: Color -> Attr
fg :: Color -> Attr
fg = (Attr
defAttr Attr -> Color -> Attr
`withForeColor`)
bg :: Color -> Attr
bg :: Color -> Attr
bg = (Attr
defAttr Attr -> Color -> Attr
`withBackColor`)
style :: Style -> Attr
style :: Style -> Attr
style = (Attr
defAttr Attr -> Style -> Attr
`withStyle`)