Themes: add newTheme convenience constructor

This commit is contained in:
Jonathan Daugherty 2017-10-30 09:33:59 -07:00
parent 2d88753db5
commit f614977d60

View File

@ -46,6 +46,7 @@ module Brick.Themes
, customStyleL
, Theme(..)
, newTheme
, themeDefaultAttrL
, themeDefaultMappingL
, themeCustomMappingL
@ -139,6 +140,18 @@ suffixLenses ''CustomAttr
suffixLenses ''Theme
suffixLenses ''ThemeDocumentation
-- | Create a new theme with the specified default attribute and
-- attribute mapping. The theme will have no documentation or
-- customizations.
newTheme :: Attr -> [(AttrName, Attr)] -> Theme
newTheme def mapping =
Theme { themeDefaultAttr = def
, themeDefaultMapping = M.fromList mapping
, themeCustomDefaultAttr = Nothing
, themeCustomMapping = mempty
, themeDocumentation = ThemeDocumentation mempty
}
-- | Build an 'AttrMap' from a 'Theme'. This applies all customizations
-- in the returned 'AttrMap'.
themeToAttrMap :: Theme -> AttrMap