ui: style help headings & keys; style cleanups

This commit is contained in:
Simon Michael 2018-10-23 06:07:35 -07:00
parent 16faa7dd9c
commit f66bb8d5c0
2 changed files with 24 additions and 17 deletions

View File

@ -68,14 +68,18 @@ themeNames = map fst themesList
themesList :: [(String, AttrMap)]
themesList = [
("default", attrMap
(black `on` white & bold) [ -- default style for this theme
("error", currentAttr `withForeColor` red),
(black `on` white) [ -- default style for this theme
(borderAttr , white `on` black & dim),
(borderAttr <> "bold", white `on` black & bold),
(borderAttr <> "query", cyan `on` black & bold),
(borderAttr <> "depth", yellow `on` black & bold),
-- (borderAttr <> "keys", black `on` white & bold),
(borderAttr <> "bold", currentAttr & bold),
(borderAttr <> "query", currentAttr `withForeColor` cyan & bold),
(borderAttr <> "depth", currentAttr `withForeColor` yellow & bold),
(borderAttr <> "key", currentAttr `withForeColor` brightWhite & bold),
(borderAttr <> "minibuffer", white `on` black & bold),
("help", white `on` black & dim),
("help" <> "heading", currentAttr `withForeColor` yellow),
("help" <> "key", currentAttr `withForeColor` brightWhite & bold),
-- ("normal" , black `on` white),
("list" , black `on` white), -- regular list items
("list" <> "selected" , white `on` blue & bold), -- selected list items
@ -88,7 +92,10 @@ themesList = [
("list" <> "amount" <> "increase" <> "selected", brightGreen `on` blue & bold),
("list" <> "amount" <> "decrease" <> "selected", brightRed `on` blue & bold),
("list" <> "balance" <> "positive" <> "selected", white `on` blue & bold),
("list" <> "balance" <> "negative" <> "selected", brightRed `on` blue & bold)
("list" <> "balance" <> "negative" <> "selected", brightRed `on` blue & bold),
("error", currentAttr `withForeColor` red)
]),
("terminal", attrMap

View File

@ -54,38 +54,38 @@ helpDialog _copts =
Widget Fixed Fixed $ do
c <- getContext
render $
withDefAttr borderAttr $ -- color help dialog like the borders
withDefAttr "help" $
renderDialog (dialog (Just "Help (?/LEFT/ESC to close)") Nothing (c^.availWidthL)) $ -- (Just (0,[("ok",())]))
padAll 1 $
vBox [
hBox [
padRight (Pad 1) $
vBox [
str "Navigation"
withAttr ("help" <> "heading") $ str "Navigation"
,renderKey ("UP/DOWN/PUP/PDN/HOME/END/emacs/vi keys", "")
,str " move selection"
,renderKey ("RIGHT", "show more detail")
,renderKey ("LEFT ", "go back")
,renderKey ("ESC ", "cancel or reset")
,str " "
,str "Report period"
,withAttr ("help" <> "heading") $ str "Report period"
,renderKey ("S-DOWN /S-UP ", "shrink/grow period")
,renderKey ("S-RIGHT/S-LEFT", "next/previous period")
,renderKey ("t ", "set period to today")
,str " "
,str "Accounts screen"
,withAttr ("help" <> "heading") $ str "Accounts screen"
,renderKey ("-+0123456789 ", "set depth limit")
,renderKey ("T ", "toggle tree/flat mode")
,renderKey ("H ", "period change/historical end balance")
,str " "
,str "Register screen"
,withAttr ("help" <> "heading") $ str "Register screen"
,renderKey ("T ", "toggle subaccount txns\n(and accounts screen tree/flat mode)")
,renderKey ("H ", "show period total/historical total")
,str " "
]
,padLeft (Pad 1) $ padRight (Pad 0) $
vBox [
str "Filtering"
withAttr ("help" <> "heading") $ str "Filtering"
,renderKey ("/ ", "set a filter query")
,renderKey ("UPC ", "show unmarked/pending/cleared")
,renderKey ("F ", "show future/present txns")
@ -93,11 +93,11 @@ helpDialog _copts =
,renderKey ("Z ", "show nonzero/all amounts")
,renderKey ("DEL ", "remove filters")
,str " "
,str "Help"
,withAttr ("help" <> "heading") $ str "Help"
,renderKey ("? ", "toggle this help")
,renderKey ("pmi ", "(with help showing)\nshow manual in pager/man/info")
,str " "
,str "Other"
,withAttr ("help" <> "heading") $ str "Other"
,renderKey ("a ", "add transaction (hledger add)")
,renderKey ("A ", "add transaction (hledger-iadd)")
,renderKey ("E ", "open editor")
@ -122,7 +122,7 @@ helpDialog _copts =
-- ]
]
where
renderKey (key,desc) = withAttr (borderAttr <> "keys") (str key) <+> str " " <+> str desc
renderKey (key,desc) = withAttr ("help" <> "key") (str key) <+> str " " <+> str desc
-- | Event handler used when help mode is active.
-- May invoke $PAGER, less, man or info, which is likely to fail on MS Windows, TODO.
@ -177,7 +177,7 @@ borderKeysStr' :: [(String,Widget Name)] -> Widget Name
borderKeysStr' keydescs =
hBox $
intersperse sep $
[withAttr (borderAttr <> "keys") (str keys) <+> str ":" <+> desc | (keys, desc) <- keydescs]
[withAttr (borderAttr <> "key") (str keys) <+> str ":" <+> desc | (keys, desc) <- keydescs]
where
-- sep = str " | "
sep = str " "