HORIZON HASKELLDocslts/ghc-9.10.x248f8f02026-10-05Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · 248f8f0 · 2026-10-05

Modulebrick-2.10Haskell2010

Brick.Themes

Support for representing attribute themes and loading and saving theme customizations in INI-style files.

Customization files are INI-style files with two sections, both optional: "default" and "other".

The "default" section specifies three optional fields:

  • "default.fg" - a color specification

  • "default.bg" - a color specification

  • "default.style" - a style specification

A color specification can be any of the strings black, red, green, yellow, blue, magenta, cyan, white, brightBlack, brightRed, brightGreen, brightYellow, brightBlue, brightMagenta, brightCyan, brightWhite, or default.

We also support color specifications in the common hex format #RRGGBB, but note that this specification is lossy: terminals can only display 256 colors, but hex codes can specify 256^3 = 16777216 colors.

A style specification can be either one of the following values (without quotes) or a comma-delimited list of one or more of the following values (e.g. "[bold,underline]") indicating that all of the specified styles be used. Valid styles are standout, underline, reverseVideo, blink, dim, italic, strikethrough, and bold.

The other section specifies for each attribute name in the theme the same fg, bg, and style settings as for the default attribute. Furthermore, if an attribute name has multiple components, the fields in the INI file should use periods as delimiters. For example, if a theme has an attribute name (attrName "foo" <> attrName "bar"), then the file may specify three fields:

  • foo.bar.fg - a color specification

  • foo.bar.bg - a color specification

  • foo.bar.style - a style specification

Any color or style specifications omitted from the file mean that those attribute or style settings will use the theme's default value instead.

Attribute names with multiple components (e.g. attr1 <> attr2) can be referenced in customization files by separating the names with a dot. For example, the attribute name attrName "list" <> attrName "selected" can be referenced by using the string "list.selected".

  • 3 types
  • 14 values
  • Packagebrick-2.10
  • Exports17
  • LanguageHaskell2010
  • LicenceBSD-3-Clause
  • SourceThemes.hs
datadata CustomAttr
#

An attribute customization can specify which aspects of an attribute to customize.

Constructors

Instances8Eq, Read, Show, Generic, Semigroup, Monoid, …
datadata Theme
#

A theme provides a set of default attribute mappings, a default attribute, and a set of customizations for the default mapping and default attribute. The idea here is that the application will always need to provide a complete specification of its attribute mapping, but if the user wants to customize any aspect of that default mapping, it can be contained here and then built into an AttrMap (see themeToAttrMap). We keep the defaults separate from customizations to permit users to serialize themes and their customizations to, say, disk files.

Constructors

Instances6Eq, Read, Show, Generic, NFData, Rep
valuenewTheme :: Attr -> [(AttrName, Attr)] -> Theme
#

Create a new theme with the specified default attribute and attribute mapping. The theme will have no customizations.

datadata ThemeDocumentation
#

Documentation for a theme's attributes.

Constructors

Instances6Eq, Read, Show, Generic, NFData, Rep
valueapplyCustomizations
  1. :: Maybe CustomAttr

    An optional customization for the theme's default attribute.

  2. -> (AttrName -> Maybe CustomAttr)

    A function to obtain a customization for the specified attribute.

  3. -> Theme

    The theme to customize.

  4. -> Theme
#

Apply customizations using a custom lookup function. Customizations are obtained for each attribute name in the theme. Any customizations already set are lost.

Load an INI file containing theme customizations. Use the specified theme to determine which customizations to load. Return the specified theme with customizations set. See the module documentation for the theme file format.

valuesaveCustomizations :: FilePath -> Theme -> IO ()
#

Save an INI file containing theme customizations. Use the specified theme to determine which customizations to save. See the module documentation for the theme file format.

valuesaveTheme :: FilePath -> Theme -> IO ()
#

Save an INI file containing all attributes from the specified theme. Customized attributes are saved, but if an attribute is not customized, its default is saved instead. The file can later be re-loaded as a customization file.