text-ansi 0.1.1 → 0.2.0
raw patch · 8 files changed
+1123/−747 lines, 8 filesdep +text-builder
Dependencies added: text-builder
Files
- CHANGELOG.md +4/−11
- Data/Text/ANSI.hs +0/−346
- Data/Text/Builder/ANSI.hs +0/−383
- LICENSE +1/−1
- src/Text/ANSI.hs +345/−0
- src/Text/Builder/ANSI.hs +381/−0
- src/Text/Lazy/Builder/ANSI.hs +382/−0
- text-ansi.cabal +10/−6
CHANGELOG.md view
@@ -1,29 +1,22 @@-# Changelog--All notable changes to this project will be documented in this file.+## [0.2.0] - 2022-10-28 -The format is based on [Keep a Changelog](http://keepachangelog.com/)-and this project adheres to the [Haskell Package Versioning Policy](https://pvp.haskell.org/).+- Drop the `Data` prefix from `Data.Text.ANSI` and `Data.Text.Builder.ANSI` modules+- Rename `Text.Builder.ANSI` to `Text.Lazy.Builder.ANSI`+- Add `Text.Builder.ANSI` back, but based on `text-builder`'s builder instead of `text`'s builder. ## [0.1.1] - 2021-01-07 -## Added - Add `Data.Text.Builder.ANSI` module ## [0.1.0.2] - 2020-12-26 -### Changed - Fix bug in `italic` ## [0.1.0.1] - 2020-06-14 -### Changed - Relax `base` bounds--### Removed - Drop `text-builder` dependency ## [0.1.0] - 2018-11-14 -### Added - Initial release
− Data/Text/ANSI.hs
@@ -1,346 +0,0 @@-module Data.Text.ANSI- ( -- $intro-- -- * Foreground color- black,- red,- green,- yellow,- blue,- magenta,- cyan,- white,- brightBlack,- brightRed,- brightGreen,- brightYellow,- brightBlue,- brightMagenta,- brightCyan,- brightWhite,- rgb,-- -- * Background color- blackBg,- redBg,- greenBg,- yellowBg,- blueBg,- magentaBg,- cyanBg,- whiteBg,- brightBlackBg,- brightRedBg,- brightGreenBg,- brightYellowBg,- brightBlueBg,- brightMagentaBg,- brightCyanBg,- brightWhiteBg,- rgbBg,-- -- * Style- bold,- faint,- italic,- underline,- doubleUnderline,- strikethrough,- frame,- encircle,- overline,- )-where--import Data.Text (Text)-import qualified Data.Text.Builder.ANSI as Builder.ANSI-import qualified Data.Text.Lazy as Text.Lazy-import Data.Text.Lazy.Builder (Builder)-import qualified Data.Text.Lazy.Builder as Builder-import Data.Word (Word8)---- $intro------ Text styling for ANSI terminals using SGR codes, as defined by the--- <https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf ECMA-48>--- standard.------ Supports foreground\/background color, bold\/faint intensity, italic,--- single\/double underline, strikethrough, frame, encircle, and overline escape--- sequences. Some styles may not work on your terminal.------ Also features terminal detection, so redirecting styled output to a file will--- automatically strip the ANSI escape sequences.---- | Black foreground.-black :: Text -> Text-black =- lift Builder.ANSI.black-{-# INLINE black #-}---- | Red foreground.-red :: Text -> Text-red =- lift Builder.ANSI.red-{-# INLINE red #-}---- | Green foreground.-green :: Text -> Text-green =- lift Builder.ANSI.green-{-# INLINE green #-}---- | Yellow foreground.-yellow :: Text -> Text-yellow =- lift Builder.ANSI.yellow-{-# INLINE yellow #-}---- | Blue foreground.-blue :: Text -> Text-blue =- lift Builder.ANSI.blue-{-# INLINE blue #-}---- | Magenta foreground.-magenta :: Text -> Text-magenta =- lift Builder.ANSI.magenta-{-# INLINE magenta #-}---- | Cyan foreground.-cyan :: Text -> Text-cyan =- lift Builder.ANSI.cyan-{-# INLINE cyan #-}---- | White foreground.-white :: Text -> Text-white =- lift Builder.ANSI.white-{-# INLINE white #-}---- | Bright black foreground.-brightBlack :: Text -> Text-brightBlack =- lift Builder.ANSI.brightBlack-{-# INLINE brightBlack #-}---- | Bright red foreground.-brightRed :: Text -> Text-brightRed =- lift Builder.ANSI.brightRed-{-# INLINE brightRed #-}---- | Bright green foreground.-brightGreen :: Text -> Text-brightGreen =- lift Builder.ANSI.brightGreen-{-# INLINE brightGreen #-}---- | Bright yellow foreground.-brightYellow :: Text -> Text-brightYellow =- lift Builder.ANSI.brightYellow-{-# INLINE brightYellow #-}---- | Bright blue foreground.-brightBlue :: Text -> Text-brightBlue =- lift Builder.ANSI.brightBlue-{-# INLINE brightBlue #-}---- | Bright magenta foreground.-brightMagenta :: Text -> Text-brightMagenta =- lift Builder.ANSI.brightMagenta-{-# INLINE brightMagenta #-}---- | Bright cyan foreground.-brightCyan :: Text -> Text-brightCyan =- lift Builder.ANSI.brightCyan-{-# INLINE brightCyan #-}---- | Bright white foreground.-brightWhite :: Text -> Text-brightWhite =- lift Builder.ANSI.brightWhite-{-# INLINE brightWhite #-}---- | RGB foreground.-rgb :: Word8 -> Word8 -> Word8 -> Text -> Text-rgb r g b =- lift (Builder.ANSI.rgb r g b)-{-# INLINE rgb #-}---- | Black background.-blackBg :: Text -> Text-blackBg =- lift Builder.ANSI.blackBg-{-# INLINE blackBg #-}---- | Red background.-redBg :: Text -> Text-redBg =- lift Builder.ANSI.redBg-{-# INLINE redBg #-}---- | Green background.-greenBg :: Text -> Text-greenBg =- lift Builder.ANSI.greenBg-{-# INLINE greenBg #-}---- | Yellow background.-yellowBg :: Text -> Text-yellowBg =- lift Builder.ANSI.yellowBg-{-# INLINE yellowBg #-}---- | Blue background.-blueBg :: Text -> Text-blueBg =- lift Builder.ANSI.blueBg-{-# INLINE blueBg #-}---- | Magenta background.-magentaBg :: Text -> Text-magentaBg =- lift Builder.ANSI.magentaBg-{-# INLINE magentaBg #-}---- | Cyan background.-cyanBg :: Text -> Text-cyanBg =- lift Builder.ANSI.cyanBg-{-# INLINE cyanBg #-}---- | White background.-whiteBg :: Text -> Text-whiteBg =- lift Builder.ANSI.whiteBg-{-# INLINE whiteBg #-}---- | Bright black background.-brightBlackBg :: Text -> Text-brightBlackBg =- lift Builder.ANSI.brightBlackBg-{-# INLINE brightBlackBg #-}---- | Bright red background.-brightRedBg :: Text -> Text-brightRedBg =- lift Builder.ANSI.brightRedBg-{-# INLINE brightRedBg #-}---- | Bright green background.-brightGreenBg :: Text -> Text-brightGreenBg =- lift Builder.ANSI.brightGreenBg-{-# INLINE brightGreenBg #-}---- | Bright yellow background.-brightYellowBg :: Text -> Text-brightYellowBg =- lift Builder.ANSI.brightYellowBg-{-# INLINE brightYellowBg #-}---- | Bright blue background.-brightBlueBg :: Text -> Text-brightBlueBg =- lift Builder.ANSI.brightBlueBg-{-# INLINE brightBlueBg #-}---- | Bright magenta background.-brightMagentaBg :: Text -> Text-brightMagentaBg =- lift Builder.ANSI.brightMagentaBg-{-# INLINE brightMagentaBg #-}---- | Bright cyan background.-brightCyanBg :: Text -> Text-brightCyanBg =- lift Builder.ANSI.brightCyanBg-{-# INLINE brightCyanBg #-}---- | Bright white background.-brightWhiteBg :: Text -> Text-brightWhiteBg =- lift Builder.ANSI.brightWhiteBg-{-# INLINE brightWhiteBg #-}---- | RGB background.-rgbBg :: Word8 -> Word8 -> Word8 -> Text -> Text-rgbBg r g b =- lift (Builder.ANSI.rgbBg r g b)-{-# INLINE rgbBg #-}---- | __Bold__ style (high intensity).-bold :: Text -> Text-bold =- lift Builder.ANSI.bold-{-# INLINE bold #-}---- | Faint style (low intensity).-faint :: Text -> Text-faint =- lift Builder.ANSI.faint-{-# INLINE faint #-}---- | /Italic/ style.-italic :: Text -> Text-italic =- lift Builder.ANSI.italic-{-# INLINE italic #-}---- | U̲n̲d̲e̲r̲l̲i̲n̲e̲ style.-underline :: Text -> Text-underline =- lift Builder.ANSI.underline-{-# INLINE underline #-}---- | D̳o̳u̳b̳l̳e̳ ̳u̳n̳d̳e̳r̳l̳i̳n̳e̳ style.-doubleUnderline :: Text -> Text-doubleUnderline =- lift Builder.ANSI.doubleUnderline-{-# INLINE doubleUnderline #-}---- | S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style.-strikethrough :: Text -> Text-strikethrough =- lift Builder.ANSI.strikethrough-{-# INLINE strikethrough #-}---- | Frame style.-frame :: Text -> Text-frame =- lift Builder.ANSI.frame-{-# INLINE frame #-}---- | Encircle style.-encircle :: Text -> Text-encircle =- lift Builder.ANSI.encircle-{-# INLINE encircle #-}---- | O̅v̅e̅r̅l̅i̅n̅e̅ style.-overline :: Text -> Text-overline =- lift Builder.ANSI.overline-{-# INLINE overline #-}------lift :: (Builder -> Builder) -> Text -> Text-lift f =- Text.Lazy.toStrict . Builder.toLazyText . f . Builder.fromText--- Don't inline before phase 2-{-# NOINLINE [2] lift #-}---- Collapse lift/lift to a single lift before phase 2-{-# RULES-"lift/lift" [~2] forall f g s.- lift f (lift g s) =- lift (f . g) s- #-}
− Data/Text/Builder/ANSI.hs
@@ -1,383 +0,0 @@-{-# LANGUAGE CPP #-}-{-# LANGUAGE OverloadedStrings #-}--module Data.Text.Builder.ANSI- ( -- $intro-- -- * Foreground color- black,- red,- green,- yellow,- blue,- magenta,- cyan,- white,- brightBlack,- brightRed,- brightGreen,- brightYellow,- brightBlue,- brightMagenta,- brightCyan,- brightWhite,- rgb,-- -- * Background color- blackBg,- redBg,- greenBg,- yellowBg,- blueBg,- magentaBg,- cyanBg,- whiteBg,- brightBlackBg,- brightRedBg,- brightGreenBg,- brightYellowBg,- brightBlueBg,- brightMagentaBg,- brightCyanBg,- brightWhiteBg,- rgbBg,-- -- * Style- bold,- faint,- italic,- underline,- doubleUnderline,- strikethrough,- frame,- encircle,- overline,- )-where--#if !MIN_VERSION_base(4,13,0)-import Data.Semigroup ((<>))-#endif-import Data.Text.Lazy.Builder (Builder)-import qualified Data.Text.Lazy.Builder as Builder-import qualified Data.Text.Lazy.Builder.Int as Builder-import Data.Word (Word8)-import Foreign.C (CInt (CInt))-import System.IO.Unsafe (unsafePerformIO)---- $intro------ Text styling for ANSI terminals using SGR codes, as defined by the--- <https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf ECMA-48>--- standard.------ Supports foreground\/background color, bold\/faint intensity, italic,--- single\/double underline, strikethrough, frame, encircle, and overline escape--- sequences. Some styles may not work on your terminal.------ Also features terminal detection, so redirecting styled output to a file will--- automatically strip the ANSI escape sequences.---- | Black foreground.-black :: Builder -> Builder-black =- foreground "30"-{-# INLINE black #-}---- | Red foreground.-red :: Builder -> Builder-red =- foreground "31"-{-# INLINE red #-}---- | Green foreground.-green :: Builder -> Builder-green =- foreground "32"-{-# INLINE green #-}---- | Yellow foreground.-yellow :: Builder -> Builder-yellow =- foreground "33"-{-# INLINE yellow #-}---- | Blue foreground.-blue :: Builder -> Builder-blue =- foreground "34"-{-# INLINE blue #-}---- | Magenta foreground.-magenta :: Builder -> Builder-magenta =- foreground "35"-{-# INLINE magenta #-}---- | Cyan foreground.-cyan :: Builder -> Builder-cyan =- foreground "36"-{-# INLINE cyan #-}---- | White foreground.-white :: Builder -> Builder-white =- foreground "37"-{-# INLINE white #-}---- | Bright black foreground.-brightBlack :: Builder -> Builder-brightBlack =- foreground "90"-{-# INLINE brightBlack #-}---- | Bright red foreground.-brightRed :: Builder -> Builder-brightRed =- foreground "91"-{-# INLINE brightRed #-}---- | Bright green foreground.-brightGreen :: Builder -> Builder-brightGreen =- foreground "92"-{-# INLINE brightGreen #-}---- | Bright yellow foreground.-brightYellow :: Builder -> Builder-brightYellow =- foreground "93"-{-# INLINE brightYellow #-}---- | Bright blue foreground.-brightBlue :: Builder -> Builder-brightBlue =- foreground "94"-{-# INLINE brightBlue #-}---- | Bright magenta foreground.-brightMagenta :: Builder -> Builder-brightMagenta =- foreground "95"-{-# INLINE brightMagenta #-}---- | Bright cyan foreground.-brightCyan :: Builder -> Builder-brightCyan =- foreground "96"-{-# INLINE brightCyan #-}---- | Bright white foreground.-brightWhite :: Builder -> Builder-brightWhite =- foreground "97"-{-# INLINE brightWhite #-}---- | RGB foreground.-rgb :: Word8 -> Word8 -> Word8 -> Builder -> Builder-rgb r g b =- foreground ("38;2;" <> Builder.decimal r <> semi <> Builder.decimal g <> semi <> Builder.decimal b)-{-# INLINE rgb #-}--foreground :: Builder -> Builder -> Builder-foreground s =- surround s "39"-{-# INLINE foreground #-}---- | Black background.-blackBg :: Builder -> Builder-blackBg =- background "40"-{-# INLINE blackBg #-}---- | Red background.-redBg :: Builder -> Builder-redBg =- background "41"-{-# INLINE redBg #-}---- | Green background.-greenBg :: Builder -> Builder-greenBg =- background "42"-{-# INLINE greenBg #-}---- | Yellow background.-yellowBg :: Builder -> Builder-yellowBg =- background "43"-{-# INLINE yellowBg #-}---- | Blue background.-blueBg :: Builder -> Builder-blueBg =- background "44"-{-# INLINE blueBg #-}---- | Magenta background.-magentaBg :: Builder -> Builder-magentaBg =- background "45"-{-# INLINE magentaBg #-}---- | Cyan background.-cyanBg :: Builder -> Builder-cyanBg =- background "46"-{-# INLINE cyanBg #-}---- | White background.-whiteBg :: Builder -> Builder-whiteBg =- background "47"-{-# INLINE whiteBg #-}---- | Bright black background.-brightBlackBg :: Builder -> Builder-brightBlackBg =- background "100"-{-# INLINE brightBlackBg #-}---- | Bright red background.-brightRedBg :: Builder -> Builder-brightRedBg =- background "101"-{-# INLINE brightRedBg #-}---- | Bright green background.-brightGreenBg :: Builder -> Builder-brightGreenBg =- background "102"-{-# INLINE brightGreenBg #-}---- | Bright yellow background.-brightYellowBg :: Builder -> Builder-brightYellowBg =- background "103"-{-# INLINE brightYellowBg #-}---- | Bright blue background.-brightBlueBg :: Builder -> Builder-brightBlueBg =- background "104"-{-# INLINE brightBlueBg #-}---- | Bright magenta background.-brightMagentaBg :: Builder -> Builder-brightMagentaBg =- background "105"-{-# INLINE brightMagentaBg #-}---- | Bright cyan background.-brightCyanBg :: Builder -> Builder-brightCyanBg =- background "106"-{-# INLINE brightCyanBg #-}---- | Bright white background.-brightWhiteBg :: Builder -> Builder-brightWhiteBg =- background "107"-{-# INLINE brightWhiteBg #-}--background :: Builder -> Builder -> Builder-background s =- surround s "49"-{-# INLINE background #-}---- | RGB background.-rgbBg :: Word8 -> Word8 -> Word8 -> Builder -> Builder-rgbBg r g b =- background ("48;2;" <> Builder.decimal r <> semi <> Builder.decimal g <> semi <> Builder.decimal b)-{-# INLINE rgbBg #-}---- | __Bold__ style (high intensity).-bold :: Builder -> Builder-bold =- surround "1" "22"-{-# INLINE bold #-}---- | Faint style (low intensity).-faint :: Builder -> Builder-faint =- surround "2" "22"-{-# INLINE faint #-}---- | /Italic/ style.-italic :: Builder -> Builder-italic =- surround "3" "23"-{-# INLINE italic #-}---- | U̲n̲d̲e̲r̲l̲i̲n̲e̲ style.-underline :: Builder -> Builder-underline =- surround "4" "24"-{-# INLINE underline #-}---- | D̳o̳u̳b̳l̳e̳ ̳u̳n̳d̳e̳r̳l̳i̳n̳e̳ style.-doubleUnderline :: Builder -> Builder-doubleUnderline =- surround "21" "24"-{-# INLINE doubleUnderline #-}---- | S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style.-strikethrough :: Builder -> Builder-strikethrough =- surround "9" "29"-{-# INLINE strikethrough #-}---- | Frame style.-frame :: Builder -> Builder-frame =- surround "51" "54"-{-# INLINE frame #-}---- | Encircle style.-encircle :: Builder -> Builder-encircle =- surround "52" "54"-{-# INLINE encircle #-}---- | O̅v̅e̅r̅l̅i̅n̅e̅ style.-overline :: Builder -> Builder-overline =- surround "53" "55"-{-# INLINE overline #-}------------------------------------------------------------------------------------surround :: Builder -> Builder -> Builder -> Builder-surround open close text- | isatty = esc <> open <> m <> text <> esc <> close <> m- | otherwise = text--- Don't inline before phase 1-{-# NOINLINE [1] surround #-}--esc :: Builder-esc =- "\ESC["--m :: Builder-m =- Builder.singleton 'm'--semi :: Builder-semi =- Builder.singleton ';'--isatty :: Bool-isatty =- unsafePerformIO (c_isatty 1) == 1-{-# NOINLINE isatty #-}--foreign import ccall unsafe "isatty"- c_isatty :: CInt -> IO CInt---- Collapse surround/surround to a single surround before phase 1-{-# RULES-"surround/surround" [~1] forall a b c d s.- surround a b (surround c d s) =- surround (a <> semi <> c) (b <> semi <> d) s- #-}
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2018 Mitchell Rosen+Copyright 2018-2022 Mitchell Rosen Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+ src/Text/ANSI.hs view
@@ -0,0 +1,345 @@+module Text.ANSI+ ( -- $intro++ -- * Foreground color+ black,+ red,+ green,+ yellow,+ blue,+ magenta,+ cyan,+ white,+ brightBlack,+ brightRed,+ brightGreen,+ brightYellow,+ brightBlue,+ brightMagenta,+ brightCyan,+ brightWhite,+ rgb,++ -- * Background color+ blackBg,+ redBg,+ greenBg,+ yellowBg,+ blueBg,+ magentaBg,+ cyanBg,+ whiteBg,+ brightBlackBg,+ brightRedBg,+ brightGreenBg,+ brightYellowBg,+ brightBlueBg,+ brightMagentaBg,+ brightCyanBg,+ brightWhiteBg,+ rgbBg,++ -- * Style+ bold,+ faint,+ italic,+ underline,+ doubleUnderline,+ strikethrough,+ frame,+ encircle,+ overline,+ )+where++import Data.Text (Text)+import Data.Word (Word8)+import Text.Builder (Builder)+import qualified Text.Builder as Builder+import qualified Text.Builder.ANSI as Builder.ANSI++-- $intro+--+-- Text styling for ANSI terminals using SGR codes, as defined by the+-- <https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf ECMA-48>+-- standard.+--+-- Supports foreground\/background color, bold\/faint intensity, italic,+-- single\/double underline, strikethrough, frame, encircle, and overline escape+-- sequences. Some styles may not work on your terminal.+--+-- Also features terminal detection, so redirecting styled output to a file will+-- automatically strip the ANSI escape sequences.++-- | Black foreground.+black :: Text -> Text+black =+ lift Builder.ANSI.black+{-# INLINE black #-}++-- | Red foreground.+red :: Text -> Text+red =+ lift Builder.ANSI.red+{-# INLINE red #-}++-- | Green foreground.+green :: Text -> Text+green =+ lift Builder.ANSI.green+{-# INLINE green #-}++-- | Yellow foreground.+yellow :: Text -> Text+yellow =+ lift Builder.ANSI.yellow+{-# INLINE yellow #-}++-- | Blue foreground.+blue :: Text -> Text+blue =+ lift Builder.ANSI.blue+{-# INLINE blue #-}++-- | Magenta foreground.+magenta :: Text -> Text+magenta =+ lift Builder.ANSI.magenta+{-# INLINE magenta #-}++-- | Cyan foreground.+cyan :: Text -> Text+cyan =+ lift Builder.ANSI.cyan+{-# INLINE cyan #-}++-- | White foreground.+white :: Text -> Text+white =+ lift Builder.ANSI.white+{-# INLINE white #-}++-- | Bright black foreground.+brightBlack :: Text -> Text+brightBlack =+ lift Builder.ANSI.brightBlack+{-# INLINE brightBlack #-}++-- | Bright red foreground.+brightRed :: Text -> Text+brightRed =+ lift Builder.ANSI.brightRed+{-# INLINE brightRed #-}++-- | Bright green foreground.+brightGreen :: Text -> Text+brightGreen =+ lift Builder.ANSI.brightGreen+{-# INLINE brightGreen #-}++-- | Bright yellow foreground.+brightYellow :: Text -> Text+brightYellow =+ lift Builder.ANSI.brightYellow+{-# INLINE brightYellow #-}++-- | Bright blue foreground.+brightBlue :: Text -> Text+brightBlue =+ lift Builder.ANSI.brightBlue+{-# INLINE brightBlue #-}++-- | Bright magenta foreground.+brightMagenta :: Text -> Text+brightMagenta =+ lift Builder.ANSI.brightMagenta+{-# INLINE brightMagenta #-}++-- | Bright cyan foreground.+brightCyan :: Text -> Text+brightCyan =+ lift Builder.ANSI.brightCyan+{-# INLINE brightCyan #-}++-- | Bright white foreground.+brightWhite :: Text -> Text+brightWhite =+ lift Builder.ANSI.brightWhite+{-# INLINE brightWhite #-}++-- | RGB foreground.+rgb :: Word8 -> Word8 -> Word8 -> Text -> Text+rgb r g b =+ lift (Builder.ANSI.rgb r g b)+{-# INLINE rgb #-}++-- | Black background.+blackBg :: Text -> Text+blackBg =+ lift Builder.ANSI.blackBg+{-# INLINE blackBg #-}++-- | Red background.+redBg :: Text -> Text+redBg =+ lift Builder.ANSI.redBg+{-# INLINE redBg #-}++-- | Green background.+greenBg :: Text -> Text+greenBg =+ lift Builder.ANSI.greenBg+{-# INLINE greenBg #-}++-- | Yellow background.+yellowBg :: Text -> Text+yellowBg =+ lift Builder.ANSI.yellowBg+{-# INLINE yellowBg #-}++-- | Blue background.+blueBg :: Text -> Text+blueBg =+ lift Builder.ANSI.blueBg+{-# INLINE blueBg #-}++-- | Magenta background.+magentaBg :: Text -> Text+magentaBg =+ lift Builder.ANSI.magentaBg+{-# INLINE magentaBg #-}++-- | Cyan background.+cyanBg :: Text -> Text+cyanBg =+ lift Builder.ANSI.cyanBg+{-# INLINE cyanBg #-}++-- | White background.+whiteBg :: Text -> Text+whiteBg =+ lift Builder.ANSI.whiteBg+{-# INLINE whiteBg #-}++-- | Bright black background.+brightBlackBg :: Text -> Text+brightBlackBg =+ lift Builder.ANSI.brightBlackBg+{-# INLINE brightBlackBg #-}++-- | Bright red background.+brightRedBg :: Text -> Text+brightRedBg =+ lift Builder.ANSI.brightRedBg+{-# INLINE brightRedBg #-}++-- | Bright green background.+brightGreenBg :: Text -> Text+brightGreenBg =+ lift Builder.ANSI.brightGreenBg+{-# INLINE brightGreenBg #-}++-- | Bright yellow background.+brightYellowBg :: Text -> Text+brightYellowBg =+ lift Builder.ANSI.brightYellowBg+{-# INLINE brightYellowBg #-}++-- | Bright blue background.+brightBlueBg :: Text -> Text+brightBlueBg =+ lift Builder.ANSI.brightBlueBg+{-# INLINE brightBlueBg #-}++-- | Bright magenta background.+brightMagentaBg :: Text -> Text+brightMagentaBg =+ lift Builder.ANSI.brightMagentaBg+{-# INLINE brightMagentaBg #-}++-- | Bright cyan background.+brightCyanBg :: Text -> Text+brightCyanBg =+ lift Builder.ANSI.brightCyanBg+{-# INLINE brightCyanBg #-}++-- | Bright white background.+brightWhiteBg :: Text -> Text+brightWhiteBg =+ lift Builder.ANSI.brightWhiteBg+{-# INLINE brightWhiteBg #-}++-- | RGB background.+rgbBg :: Word8 -> Word8 -> Word8 -> Text -> Text+rgbBg r g b =+ lift (Builder.ANSI.rgbBg r g b)+{-# INLINE rgbBg #-}++-- | __Bold__ style (high intensity).+bold :: Text -> Text+bold =+ lift Builder.ANSI.bold+{-# INLINE bold #-}++-- | Faint style (low intensity).+faint :: Text -> Text+faint =+ lift Builder.ANSI.faint+{-# INLINE faint #-}++-- | /Italic/ style.+italic :: Text -> Text+italic =+ lift Builder.ANSI.italic+{-# INLINE italic #-}++-- | U̲n̲d̲e̲r̲l̲i̲n̲e̲ style.+underline :: Text -> Text+underline =+ lift Builder.ANSI.underline+{-# INLINE underline #-}++-- | D̳o̳u̳b̳l̳e̳ ̳u̳n̳d̳e̳r̳l̳i̳n̳e̳ style.+doubleUnderline :: Text -> Text+doubleUnderline =+ lift Builder.ANSI.doubleUnderline+{-# INLINE doubleUnderline #-}++-- | S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style.+strikethrough :: Text -> Text+strikethrough =+ lift Builder.ANSI.strikethrough+{-# INLINE strikethrough #-}++-- | Frame style.+frame :: Text -> Text+frame =+ lift Builder.ANSI.frame+{-# INLINE frame #-}++-- | Encircle style.+encircle :: Text -> Text+encircle =+ lift Builder.ANSI.encircle+{-# INLINE encircle #-}++-- | O̅v̅e̅r̅l̅i̅n̅e̅ style.+overline :: Text -> Text+overline =+ lift Builder.ANSI.overline+{-# INLINE overline #-}++--++lift :: (Builder -> Builder) -> Text -> Text+lift f =+ Builder.run . f . Builder.text+-- Don't inline before phase 2+{-# NOINLINE [2] lift #-}++-- Collapse lift/lift to a single lift before phase 2+{-# RULES+"lift/lift" [~2] forall f g s.+ lift f (lift g s) =+ lift (f . g) s+ #-}
+ src/Text/Builder/ANSI.hs view
@@ -0,0 +1,381 @@+{-# LANGUAGE CPP #-}++module Text.Builder.ANSI+ ( -- $intro++ -- * Foreground color+ black,+ red,+ green,+ yellow,+ blue,+ magenta,+ cyan,+ white,+ brightBlack,+ brightRed,+ brightGreen,+ brightYellow,+ brightBlue,+ brightMagenta,+ brightCyan,+ brightWhite,+ rgb,++ -- * Background color+ blackBg,+ redBg,+ greenBg,+ yellowBg,+ blueBg,+ magentaBg,+ cyanBg,+ whiteBg,+ brightBlackBg,+ brightRedBg,+ brightGreenBg,+ brightYellowBg,+ brightBlueBg,+ brightMagentaBg,+ brightCyanBg,+ brightWhiteBg,+ rgbBg,++ -- * Style+ bold,+ faint,+ italic,+ underline,+ doubleUnderline,+ strikethrough,+ frame,+ encircle,+ overline,+ )+where++#if !MIN_VERSION_base(4,13,0)+import Data.Semigroup ((<>))+#endif+import Text.Builder (Builder)+import qualified Text.Builder as Builder+import Data.Word (Word8)+import Foreign.C (CInt (CInt))+import System.IO.Unsafe (unsafePerformIO)++-- $intro+--+-- Text styling for ANSI terminals using SGR codes, as defined by the+-- <https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf ECMA-48>+-- standard.+--+-- Supports foreground\/background color, bold\/faint intensity, italic,+-- single\/double underline, strikethrough, frame, encircle, and overline escape+-- sequences. Some styles may not work on your terminal.+--+-- Also features terminal detection, so redirecting styled output to a file will+-- automatically strip the ANSI escape sequences.++-- | Black foreground.+black :: Builder -> Builder+black =+ foreground (Builder.string "30")+{-# INLINE black #-}++-- | Red foreground.+red :: Builder -> Builder+red =+ foreground (Builder.string "31")+{-# INLINE red #-}++-- | Green foreground.+green :: Builder -> Builder+green =+ foreground (Builder.string "32")+{-# INLINE green #-}++-- | Yellow foreground.+yellow :: Builder -> Builder+yellow =+ foreground (Builder.string "33")+{-# INLINE yellow #-}++-- | Blue foreground.+blue :: Builder -> Builder+blue =+ foreground (Builder.string "34")+{-# INLINE blue #-}++-- | Magenta foreground.+magenta :: Builder -> Builder+magenta =+ foreground (Builder.string "35")+{-# INLINE magenta #-}++-- | Cyan foreground.+cyan :: Builder -> Builder+cyan =+ foreground (Builder.string "36")+{-# INLINE cyan #-}++-- | White foreground.+white :: Builder -> Builder+white =+ foreground (Builder.string "37")+{-# INLINE white #-}++-- | Bright black foreground.+brightBlack :: Builder -> Builder+brightBlack =+ foreground (Builder.string "90")+{-# INLINE brightBlack #-}++-- | Bright red foreground.+brightRed :: Builder -> Builder+brightRed =+ foreground (Builder.string "91")+{-# INLINE brightRed #-}++-- | Bright green foreground.+brightGreen :: Builder -> Builder+brightGreen =+ foreground (Builder.string "92")+{-# INLINE brightGreen #-}++-- | Bright yellow foreground.+brightYellow :: Builder -> Builder+brightYellow =+ foreground (Builder.string "93")+{-# INLINE brightYellow #-}++-- | Bright blue foreground.+brightBlue :: Builder -> Builder+brightBlue =+ foreground (Builder.string "94")+{-# INLINE brightBlue #-}++-- | Bright magenta foreground.+brightMagenta :: Builder -> Builder+brightMagenta =+ foreground (Builder.string "95")+{-# INLINE brightMagenta #-}++-- | Bright cyan foreground.+brightCyan :: Builder -> Builder+brightCyan =+ foreground (Builder.string "96")+{-# INLINE brightCyan #-}++-- | Bright white foreground.+brightWhite :: Builder -> Builder+brightWhite =+ foreground (Builder.string "97")+{-# INLINE brightWhite #-}++-- | RGB foreground.+rgb :: Word8 -> Word8 -> Word8 -> Builder -> Builder+rgb r g b =+ foreground (Builder.string "38;2;" <> Builder.decimal r <> semi <> Builder.decimal g <> semi <> Builder.decimal b)+{-# INLINE rgb #-}++foreground :: Builder -> Builder -> Builder+foreground s =+ surround s (Builder.string "39")+{-# INLINE foreground #-}++-- | Black background.+blackBg :: Builder -> Builder+blackBg =+ background (Builder.string "40")+{-# INLINE blackBg #-}++-- | Red background.+redBg :: Builder -> Builder+redBg =+ background (Builder.string "41")+{-# INLINE redBg #-}++-- | Green background.+greenBg :: Builder -> Builder+greenBg =+ background (Builder.string "42")+{-# INLINE greenBg #-}++-- | Yellow background.+yellowBg :: Builder -> Builder+yellowBg =+ background (Builder.string "43")+{-# INLINE yellowBg #-}++-- | Blue background.+blueBg :: Builder -> Builder+blueBg =+ background (Builder.string "44")+{-# INLINE blueBg #-}++-- | Magenta background.+magentaBg :: Builder -> Builder+magentaBg =+ background (Builder.string "45")+{-# INLINE magentaBg #-}++-- | Cyan background.+cyanBg :: Builder -> Builder+cyanBg =+ background (Builder.string "46")+{-# INLINE cyanBg #-}++-- | White background.+whiteBg :: Builder -> Builder+whiteBg =+ background (Builder.string "47")+{-# INLINE whiteBg #-}++-- | Bright black background.+brightBlackBg :: Builder -> Builder+brightBlackBg =+ background (Builder.string "100")+{-# INLINE brightBlackBg #-}++-- | Bright red background.+brightRedBg :: Builder -> Builder+brightRedBg =+ background (Builder.string "101")+{-# INLINE brightRedBg #-}++-- | Bright green background.+brightGreenBg :: Builder -> Builder+brightGreenBg =+ background (Builder.string "102")+{-# INLINE brightGreenBg #-}++-- | Bright yellow background.+brightYellowBg :: Builder -> Builder+brightYellowBg =+ background (Builder.string "103")+{-# INLINE brightYellowBg #-}++-- | Bright blue background.+brightBlueBg :: Builder -> Builder+brightBlueBg =+ background (Builder.string "104")+{-# INLINE brightBlueBg #-}++-- | Bright magenta background.+brightMagentaBg :: Builder -> Builder+brightMagentaBg =+ background (Builder.string "105")+{-# INLINE brightMagentaBg #-}++-- | Bright cyan background.+brightCyanBg :: Builder -> Builder+brightCyanBg =+ background (Builder.string "106")+{-# INLINE brightCyanBg #-}++-- | Bright white background.+brightWhiteBg :: Builder -> Builder+brightWhiteBg =+ background (Builder.string "107")+{-# INLINE brightWhiteBg #-}++background :: Builder -> Builder -> Builder+background s =+ surround s (Builder.string "49")+{-# INLINE background #-}++-- | RGB background.+rgbBg :: Word8 -> Word8 -> Word8 -> Builder -> Builder+rgbBg r g b =+ background (Builder.string "48;2;" <> Builder.decimal r <> semi <> Builder.decimal g <> semi <> Builder.decimal b)+{-# INLINE rgbBg #-}++-- | __Bold__ style (high intensity).+bold :: Builder -> Builder+bold =+ surround (Builder.string "1") (Builder.string "22")+{-# INLINE bold #-}++-- | Faint style (low intensity).+faint :: Builder -> Builder+faint =+ surround (Builder.string "2") (Builder.string "22")+{-# INLINE faint #-}++-- | /Italic/ style.+italic :: Builder -> Builder+italic =+ surround (Builder.string "3") (Builder.string "23")+{-# INLINE italic #-}++-- | U̲n̲d̲e̲r̲l̲i̲n̲e̲ style.+underline :: Builder -> Builder+underline =+ surround (Builder.string "4") (Builder.string "24")+{-# INLINE underline #-}++-- | D̳o̳u̳b̳l̳e̳ ̳u̳n̳d̳e̳r̳l̳i̳n̳e̳ style.+doubleUnderline :: Builder -> Builder+doubleUnderline =+ surround (Builder.string "21") (Builder.string "24")+{-# INLINE doubleUnderline #-}++-- | S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style.+strikethrough :: Builder -> Builder+strikethrough =+ surround (Builder.string "9") (Builder.string "29")+{-# INLINE strikethrough #-}++-- | Frame style.+frame :: Builder -> Builder+frame =+ surround (Builder.string "51") (Builder.string "54")+{-# INLINE frame #-}++-- | Encircle style.+encircle :: Builder -> Builder+encircle =+ surround (Builder.string "52") (Builder.string "54")+{-# INLINE encircle #-}++-- | O̅v̅e̅r̅l̅i̅n̅e̅ style.+overline :: Builder -> Builder+overline =+ surround (Builder.string "53") (Builder.string "55")+{-# INLINE overline #-}++--------------------------------------------------------------------------------++surround :: Builder -> Builder -> Builder -> Builder+surround open close text+ | isatty = esc <> open <> m <> text <> esc <> close <> m+ | otherwise = text+-- Don't inline before phase 1+{-# NOINLINE [1] surround #-}++esc :: Builder+esc =+ Builder.string "\ESC["++m :: Builder+m =+ Builder.char 'm'++semi :: Builder+semi =+ Builder.char ';'++isatty :: Bool+isatty =+ unsafePerformIO (c_isatty 1) == 1+{-# NOINLINE isatty #-}++foreign import ccall unsafe "isatty"+ c_isatty :: CInt -> IO CInt++-- Collapse surround/surround to a single surround before phase 1+{-# RULES+"surround/surround" [~1] forall a b c d s.+ surround a b (surround c d s) =+ surround (a <> semi <> c) (b <> semi <> d) s+ #-}
+ src/Text/Lazy/Builder/ANSI.hs view
@@ -0,0 +1,382 @@+{-# LANGUAGE CPP #-}++module Text.Lazy.Builder.ANSI+ ( -- $intro++ -- * Foreground color+ black,+ red,+ green,+ yellow,+ blue,+ magenta,+ cyan,+ white,+ brightBlack,+ brightRed,+ brightGreen,+ brightYellow,+ brightBlue,+ brightMagenta,+ brightCyan,+ brightWhite,+ rgb,++ -- * Background color+ blackBg,+ redBg,+ greenBg,+ yellowBg,+ blueBg,+ magentaBg,+ cyanBg,+ whiteBg,+ brightBlackBg,+ brightRedBg,+ brightGreenBg,+ brightYellowBg,+ brightBlueBg,+ brightMagentaBg,+ brightCyanBg,+ brightWhiteBg,+ rgbBg,++ -- * Style+ bold,+ faint,+ italic,+ underline,+ doubleUnderline,+ strikethrough,+ frame,+ encircle,+ overline,+ )+where++#if !MIN_VERSION_base(4,13,0)+import Data.Semigroup ((<>))+#endif+import Data.Text.Lazy.Builder (Builder)+import qualified Data.Text.Lazy.Builder as Builder+import qualified Data.Text.Lazy.Builder.Int as Builder+import Data.Word (Word8)+import Foreign.C (CInt (CInt))+import System.IO.Unsafe (unsafePerformIO)++-- $intro+--+-- Text styling for ANSI terminals using SGR codes, as defined by the+-- <https://www.ecma-international.org/publications/files/ECMA-ST/Ecma-048.pdf ECMA-48>+-- standard.+--+-- Supports foreground\/background color, bold\/faint intensity, italic,+-- single\/double underline, strikethrough, frame, encircle, and overline escape+-- sequences. Some styles may not work on your terminal.+--+-- Also features terminal detection, so redirecting styled output to a file will+-- automatically strip the ANSI escape sequences.++-- | Black foreground.+black :: Builder -> Builder+black =+ foreground (Builder.fromString "30")+{-# INLINE black #-}++-- | Red foreground.+red :: Builder -> Builder+red =+ foreground (Builder.fromString "31")+{-# INLINE red #-}++-- | Green foreground.+green :: Builder -> Builder+green =+ foreground (Builder.fromString "32")+{-# INLINE green #-}++-- | Yellow foreground.+yellow :: Builder -> Builder+yellow =+ foreground (Builder.fromString "33")+{-# INLINE yellow #-}++-- | Blue foreground.+blue :: Builder -> Builder+blue =+ foreground (Builder.fromString "34")+{-# INLINE blue #-}++-- | Magenta foreground.+magenta :: Builder -> Builder+magenta =+ foreground (Builder.fromString "35")+{-# INLINE magenta #-}++-- | Cyan foreground.+cyan :: Builder -> Builder+cyan =+ foreground (Builder.fromString "36")+{-# INLINE cyan #-}++-- | White foreground.+white :: Builder -> Builder+white =+ foreground (Builder.fromString "37")+{-# INLINE white #-}++-- | Bright black foreground.+brightBlack :: Builder -> Builder+brightBlack =+ foreground (Builder.fromString "90")+{-# INLINE brightBlack #-}++-- | Bright red foreground.+brightRed :: Builder -> Builder+brightRed =+ foreground (Builder.fromString "91")+{-# INLINE brightRed #-}++-- | Bright green foreground.+brightGreen :: Builder -> Builder+brightGreen =+ foreground (Builder.fromString "92")+{-# INLINE brightGreen #-}++-- | Bright yellow foreground.+brightYellow :: Builder -> Builder+brightYellow =+ foreground (Builder.fromString "93")+{-# INLINE brightYellow #-}++-- | Bright blue foreground.+brightBlue :: Builder -> Builder+brightBlue =+ foreground (Builder.fromString "94")+{-# INLINE brightBlue #-}++-- | Bright magenta foreground.+brightMagenta :: Builder -> Builder+brightMagenta =+ foreground (Builder.fromString "95")+{-# INLINE brightMagenta #-}++-- | Bright cyan foreground.+brightCyan :: Builder -> Builder+brightCyan =+ foreground (Builder.fromString "96")+{-# INLINE brightCyan #-}++-- | Bright white foreground.+brightWhite :: Builder -> Builder+brightWhite =+ foreground (Builder.fromString "97")+{-# INLINE brightWhite #-}++-- | RGB foreground.+rgb :: Word8 -> Word8 -> Word8 -> Builder -> Builder+rgb r g b =+ foreground (Builder.fromString "38;2;" <> Builder.decimal r <> semi <> Builder.decimal g <> semi <> Builder.decimal b)+{-# INLINE rgb #-}++foreground :: Builder -> Builder -> Builder+foreground s =+ surround s (Builder.fromString "39")+{-# INLINE foreground #-}++-- | Black background.+blackBg :: Builder -> Builder+blackBg =+ background (Builder.fromString "40")+{-# INLINE blackBg #-}++-- | Red background.+redBg :: Builder -> Builder+redBg =+ background (Builder.fromString "41")+{-# INLINE redBg #-}++-- | Green background.+greenBg :: Builder -> Builder+greenBg =+ background (Builder.fromString "42")+{-# INLINE greenBg #-}++-- | Yellow background.+yellowBg :: Builder -> Builder+yellowBg =+ background (Builder.fromString "43")+{-# INLINE yellowBg #-}++-- | Blue background.+blueBg :: Builder -> Builder+blueBg =+ background (Builder.fromString "44")+{-# INLINE blueBg #-}++-- | Magenta background.+magentaBg :: Builder -> Builder+magentaBg =+ background (Builder.fromString "45")+{-# INLINE magentaBg #-}++-- | Cyan background.+cyanBg :: Builder -> Builder+cyanBg =+ background (Builder.fromString "46")+{-# INLINE cyanBg #-}++-- | White background.+whiteBg :: Builder -> Builder+whiteBg =+ background (Builder.fromString "47")+{-# INLINE whiteBg #-}++-- | Bright black background.+brightBlackBg :: Builder -> Builder+brightBlackBg =+ background (Builder.fromString "100")+{-# INLINE brightBlackBg #-}++-- | Bright red background.+brightRedBg :: Builder -> Builder+brightRedBg =+ background (Builder.fromString "101")+{-# INLINE brightRedBg #-}++-- | Bright green background.+brightGreenBg :: Builder -> Builder+brightGreenBg =+ background (Builder.fromString "102")+{-# INLINE brightGreenBg #-}++-- | Bright yellow background.+brightYellowBg :: Builder -> Builder+brightYellowBg =+ background (Builder.fromString "103")+{-# INLINE brightYellowBg #-}++-- | Bright blue background.+brightBlueBg :: Builder -> Builder+brightBlueBg =+ background (Builder.fromString "104")+{-# INLINE brightBlueBg #-}++-- | Bright magenta background.+brightMagentaBg :: Builder -> Builder+brightMagentaBg =+ background (Builder.fromString "105")+{-# INLINE brightMagentaBg #-}++-- | Bright cyan background.+brightCyanBg :: Builder -> Builder+brightCyanBg =+ background (Builder.fromString "106")+{-# INLINE brightCyanBg #-}++-- | Bright white background.+brightWhiteBg :: Builder -> Builder+brightWhiteBg =+ background (Builder.fromString "107")+{-# INLINE brightWhiteBg #-}++background :: Builder -> Builder -> Builder+background s =+ surround s (Builder.fromString "49")+{-# INLINE background #-}++-- | RGB background.+rgbBg :: Word8 -> Word8 -> Word8 -> Builder -> Builder+rgbBg r g b =+ background (Builder.fromString "48;2;" <> Builder.decimal r <> semi <> Builder.decimal g <> semi <> Builder.decimal b)+{-# INLINE rgbBg #-}++-- | __Bold__ style (high intensity).+bold :: Builder -> Builder+bold =+ surround (Builder.fromString "1") (Builder.fromString "22")+{-# INLINE bold #-}++-- | Faint style (low intensity).+faint :: Builder -> Builder+faint =+ surround (Builder.fromString "2") (Builder.fromString "22")+{-# INLINE faint #-}++-- | /Italic/ style.+italic :: Builder -> Builder+italic =+ surround (Builder.fromString "3") (Builder.fromString "23")+{-# INLINE italic #-}++-- | U̲n̲d̲e̲r̲l̲i̲n̲e̲ style.+underline :: Builder -> Builder+underline =+ surround (Builder.fromString "4") (Builder.fromString "24")+{-# INLINE underline #-}++-- | D̳o̳u̳b̳l̳e̳ ̳u̳n̳d̳e̳r̳l̳i̳n̳e̳ style.+doubleUnderline :: Builder -> Builder+doubleUnderline =+ surround (Builder.fromString "21") (Builder.fromString "24")+{-# INLINE doubleUnderline #-}++-- | S̶t̶r̶i̶k̶e̶t̶h̶r̶o̶u̶g̶h̶ style.+strikethrough :: Builder -> Builder+strikethrough =+ surround (Builder.fromString "9") (Builder.fromString "29")+{-# INLINE strikethrough #-}++-- | Frame style.+frame :: Builder -> Builder+frame =+ surround (Builder.fromString "51") (Builder.fromString "54")+{-# INLINE frame #-}++-- | Encircle style.+encircle :: Builder -> Builder+encircle =+ surround (Builder.fromString "52") (Builder.fromString "54")+{-# INLINE encircle #-}++-- | O̅v̅e̅r̅l̅i̅n̅e̅ style.+overline :: Builder -> Builder+overline =+ surround (Builder.fromString "53") (Builder.fromString "55")+{-# INLINE overline #-}++--------------------------------------------------------------------------------++surround :: Builder -> Builder -> Builder -> Builder+surround open close text+ | isatty = esc <> open <> m <> text <> esc <> close <> m+ | otherwise = text+-- Don't inline before phase 1+{-# NOINLINE [1] surround #-}++esc :: Builder+esc =+ Builder.fromString "\ESC["++m :: Builder+m =+ Builder.singleton 'm'++semi :: Builder+semi =+ Builder.singleton ';'++isatty :: Bool+isatty =+ unsafePerformIO (c_isatty 1) == 1+{-# NOINLINE isatty #-}++foreign import ccall unsafe "isatty"+ c_isatty :: CInt -> IO CInt++-- Collapse surround/surround to a single surround before phase 1+{-# RULES+"surround/surround" [~1] forall a b c d s.+ surround a b (surround c d s) =+ surround (a <> semi <> c) (b <> semi <> d) s+ #-}
text-ansi.cabal view
@@ -1,7 +1,7 @@ cabal-version: 2.2 name: text-ansi-version: 0.1.1+version: 0.2.0 category: Data synopsis: Text styling for ANSI terminals. description:@@ -19,7 +19,7 @@ maintainer: Mitchell Rosen <mitchellwrosen@gmail.com> homepage: https://github.com/mitchellwrosen/text-ansi bug-reports: https://github.com/mitchellwrosen/text-ansi/issues-copyright: (c) 2018-2020, Mitchell Rosen+copyright: (c) 2018-2022, Mitchell Rosen license: BSD-3-Clause license-file: LICENSE build-type: Simple@@ -35,13 +35,15 @@ library build-depends:- base >= 4.9 && < 4.15,- text >= 1.0 && < 1.3,+ base >= 4.9 && < 4.18,+ text >= 1.0 && < 2.1,+ text-builder ^>= 0.6.7, default-language: Haskell2010 exposed-modules:- Data.Text.ANSI- Data.Text.Builder.ANSI+ Text.ANSI+ Text.Builder.ANSI+ Text.Lazy.Builder.ANSI ghc-options: -Weverything -Wno-implicit-prelude@@ -52,3 +54,5 @@ ghc-options: -Wno-missing-safe-haskell-mode -Wno-prepositive-qualified-module+ hs-source-dirs:+ src