2015-06-08 08:50:08 +03:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
2015-05-19 20:23:58 +03:00
|
|
|
module Main where
|
|
|
|
|
2015-06-14 23:23:58 +03:00
|
|
|
import Data.Monoid ((<>))
|
|
|
|
import Graphics.Vty
|
|
|
|
import Data.Text.Markup ((@@))
|
2015-06-08 08:50:08 +03:00
|
|
|
|
2015-05-19 20:23:58 +03:00
|
|
|
import Brick.Main
|
2015-06-08 08:50:08 +03:00
|
|
|
import Brick.Util
|
2015-05-30 04:25:46 +03:00
|
|
|
import Brick.Render
|
2015-06-14 23:23:58 +03:00
|
|
|
import Brick.Markup
|
2015-06-15 02:14:35 +03:00
|
|
|
import Brick.AttrMap
|
2015-05-19 20:23:58 +03:00
|
|
|
|
2015-06-08 08:50:08 +03:00
|
|
|
ui :: Render
|
2015-06-15 02:14:35 +03:00
|
|
|
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-06-08 08:50:08 +03:00
|
|
|
|
2015-05-19 20:23:58 +03:00
|
|
|
main :: IO ()
|
2015-06-15 02:14:35 +03:00
|
|
|
main = simpleMain aMap [ui]
|