2015-06-29 06:16:51 +03:00
|
|
|
{-# LANGUAGE OverloadedStrings #-}
|
|
|
|
module Main where
|
|
|
|
|
|
|
|
import Data.Monoid ((<>))
|
|
|
|
import Graphics.Vty
|
|
|
|
|
|
|
|
import Brick.Main
|
|
|
|
import Brick.Widgets.Core
|
2015-06-29 06:18:59 +03:00
|
|
|
import Brick.Util (on, fg)
|
|
|
|
import Brick.Markup (markup, (@?))
|
|
|
|
import Brick.AttrMap (attrMap, AttrMap)
|
2015-06-29 06:16:51 +03:00
|
|
|
import Data.Text.Markup ((@@))
|
|
|
|
|
|
|
|
ui :: Widget
|
|
|
|
ui = m1 <=> m2
|
|
|
|
where
|
|
|
|
m1 = markup $ ("Hello" @@ fg blue) <> ", " <> ("world!" @@ fg red)
|
|
|
|
m2 = markup $ ("Hello" @? "keyword1") <> ", " <> ("world!" @? "keyword2")
|
|
|
|
|
|
|
|
theMap :: AttrMap
|
|
|
|
theMap = attrMap defAttr
|
|
|
|
[ ("keyword1", fg magenta)
|
|
|
|
, ("keyword2", white `on` blue)
|
|
|
|
]
|
|
|
|
|
|
|
|
app :: App () Event
|
|
|
|
app =
|
|
|
|
App { appDraw = const [ui]
|
2015-06-29 08:38:35 +03:00
|
|
|
, appHandleEvent = resizeOrQuit
|
2015-06-29 06:16:51 +03:00
|
|
|
, appAttrMap = const theMap
|
2015-07-01 05:15:29 +03:00
|
|
|
, appStartEvent = return
|
2015-06-29 06:16:51 +03:00
|
|
|
, appChooseCursor = neverShowCursor
|
|
|
|
, appMakeVtyEvent = id
|
|
|
|
}
|
|
|
|
|
|
|
|
main :: IO ()
|
|
|
|
main = defaultMain app ()
|