escape-artist: ANSI Escape Sequence Text Decoration Made Easy
A library for text decoration with ANSI escape sequences made easy. Decorate your terminal text expressively.
Any complex data type, existing or custom, can be simply colorized by implementing the class ToEscapable
, then
output to terminal or converted to String
using the provided functions.
Simple Example
import Data.Monoid ((<>)) import Text.EscapeArtist underlines = Underline $ FgCyan "I am underlined" <> UnderlineOff " but I am not " <> FgMagenta "and I am over here" putEscLn underlines
Implementing ToEscapable
import Data.Monoid ((<>)) import Text.EscapeArtist data ABC = A | B deriving (Show, Eq) instance ToEscapable ABC where toEscapable (A) = FgRed $ show A toEscapable (B) = FgGreen $ show B instance (ToEscapable a) => ToEscapable (Maybe a) where toEscapable (Just a) = FgGreen "Just" <> Inherit " " <> FgYellow a toEscapable a = FgRed $ show a
Comprehensive Documentation
See comprehensive documentation with many examples here:
Modules
[Index] [Quick Jump]
- Text
- Text.EscapeArtist
- Text.EscapeArtist.Internal
- Text.EscapeArtist.Internal.Constants
- Text.EscapeArtist.Internal
- Text.EscapeArtist
Downloads
- escape-artist-1.2.0.1.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
Versions [RSS] | 1.0.0, 1.1.0, 1.2.0.0, 1.2.0.1 |
---|---|
Change log | CHANGELOG.md |
Dependencies | base (>=4.8.0.0 && <5), bytestring (>=0.10.4.0 && <0.11), text (>=1.2.0.4 && <1.3), unsupported-ghc-version (<0) [details] |
License | BSD-3-Clause |
Copyright | 2016-2019 Ryan Daniels |
Author | Ryan Daniels |
Maintainer | rd.github@gmail.com |
Category | Text |
Home page | https://github.com/EarthCitizen/escape-artist#readme |
Source repo | head: git clone https://github.com/EarthCitizen/escape-artist |
Uploaded | by ryan_daniels at 2020-01-28T00:03:52Z |
Distributions | |
Reverse Dependencies | 1 direct, 0 indirect [details] |
Downloads | 2165 total (10 in the last 30 days) |
Rating | 2.0 (votes: 1) [estimated by Bayesian average] |
Your Rating | |
Status | Docs available [build log] Last success reported on 2020-01-28 [all 1 reports] |