Safe Haskell | None |
---|---|
Language | Haskell2010 |
Imj.Graphics.Text.ColorString
Description
A ColorString
is a multicolored Text
.
- newtype ColorString = ColorString [(Text, LayeredColor)]
- colored :: Text -> Color8 Foreground -> ColorString
- colored' :: Text -> LayeredColor -> ColorString
- countChars :: ColorString -> Int
- data LayeredColor = LayeredColor {}
Type
newtype ColorString Source #
Constructors
ColorString [(Text, LayeredColor)] |
Instances
Show ColorString Source # | |
IsString ColorString Source # | |
Monoid ColorString Source # | |
DiscreteDistance ColorString Source # | First interpolating characters, then color. |
DiscreteInterpolation ColorString Source # | First interpolating characters, then color. |
Constructors
colored
creates a ColorString
using the specified foreground color on
black background, wherease colored'
allows you to chose both the
background and the foreground colors.
And since ColorString
is Monoid
, we can write:
str = colored "Hello" white <> colored " World" yellow
colored :: Text -> Color8 Foreground -> ColorString Source #
colored' :: Text -> LayeredColor -> ColorString Source #
Utilities
countChars :: ColorString -> Int Source #
Counts the chars in the ColorString
Reexports
data LayeredColor Source #
A background and a foreground Color8
.
Constructors
LayeredColor | |
Fields
|
Instances
Eq LayeredColor Source # | |
Show LayeredColor Source # | |
DiscreteDistance LayeredColor Source # | First interpolate background color, then foreground color |
DiscreteInterpolation LayeredColor Source # | First interpolate background color, then foreground color |