brick-0.52.1: A declarative terminal user interface library

Safe Haskell | None
Language | Haskell2010

Brick.Util

Description

Utility functions.

Synopsis

- clamp :: Ord a => a -> a -> a -> a
- on :: Color -> Color -> Attr
- fg :: Color -> Attr
- bg :: Color -> Attr
- clOffset :: CursorLocation n -> Location -> CursorLocation n

# Documentation

clamp Source #

Arguments

:: Ord a |
=> a | The minimum value
-> a | The maximum value
-> a | The value to clamp
-> a |

Given a minimum value and a maximum value, clamp a value to that range (values less than the minimum map to the minimum and values greater than the maximum map to the maximum).

    >>> clamp 1 10 11
    10
    >>> clamp 1 10 2
    2
    >>> clamp 5 10 1
    5

on Source #

Arguments

:: Color | The foreground color
-> Color | The background color
-> Attr |

Build an attribute from a foreground color and a background color. Intended to be used infix.

fg :: Color -> Attr Source #

Create an attribute from the specified foreground color (the background color is the "default").

bg :: Color -> Attr Source #

Create an attribute from the specified background color (the background color is the "default").

clOffset :: CursorLocation n -> Location -> CursorLocation n Source #

Add a `Location` offset to the specified `CursorLocation`.