brick/programs/Minimal.hs

30 lines
694 B
Haskell
Raw Normal View History

{-# LANGUAGE OverloadedStrings #-}
2015-05-19 20:23:58 +03:00
module Main where
import Data.Monoid ((<>))
import Graphics.Vty
import Data.Text.Markup ((@@))
2015-05-19 20:23:58 +03:00
import Brick.Main
import Brick.Util
2015-05-30 04:25:46 +03:00
import Brick.Render
import Brick.Markup
import Brick.AttrMap
2015-05-19 20:23:58 +03:00
ui :: Render
ui = m1 <=> m2
where
-- Two ways to assign attributes to text in markup: via
-- attributes (direct) or via attribute names (indirect)
m1 = markup $ ("Hello" @? "kw1") <> ", " <> ("world!" @? "kw2")
m2 = markup $ ("Hello" @@ fg red) <> ", " <> ("world!" @@ (yellow `on` black))
aMap :: [(AttrName, Attr)]
aMap =
[ ("kw1", fg green)
, ("kw2", red `on` black)
]
2015-05-19 20:23:58 +03:00
main :: IO ()
main = simpleMain aMap [ui]