| Safe Haskell | None |
|---|---|
| Language | GHC2024 |
Lipstick.Brick
Description
Show lipstick blocks in brick and vty applications.
ui :: Widget () ui = blockWidget defaultRenderEnv (render (border roundedBorder <> padding 1 2) "Hello")
Widgets lay their block out in the width brick gives them, and take all
of it (Greedy) when the block grows. Colours are resolved for the
RenderEnv (light or dark background, profile) and handed to vty, which
downsamples them further if its output needs it. profileForColorMode
gives the profile matching a vty output.
vty measures text with its own width tables, which can disagree with lipstick's for some emoji; layouts made of such characters may be off by a column.
vty has a single underline style and no underline colour: curly, double, dotted and dashed underlines become plain ones, and underline colours are dropped.
Synopsis
- blockWidget :: RenderEnv -> Block -> Widget n
- blockImage :: RenderEnv -> Block -> Image
- profileForColorMode :: ColorMode -> ColorProfile
Documentation
blockImage :: RenderEnv -> Block -> Image Source #
A vty image of a block laid out in the environment's envWidth, as
wide and tall as the laid-out block (but see the note on widths above).
vty has no zero-width images, so a block 0 columns wide gives
emptyImage whatever its height.
profileForColorMode :: ColorMode -> ColorProfile Source #
The profile to resolve colours for, given a vty output's colour mode.