!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~ Safe-Inferred+0A chunk is some textual data coupled with a description of what color the text is, attributes like whether it is bold or underlined, etc. The chunk knows what foreground and background colors and what attributes to use for both an 8 color terminal and a 256 color terminal.Specifies all the effects (such as bold, underlining, colors, etc) that apply to this chunk, with different effects for 8 and 256 color terminals; andThe TextSpec bundles together the styles for the 8 and 256 color terminals, so that the text can be portrayed on any terminal.Describes text appearance (foreground and background colors, as well as other attributes such as bold) for a 256 color terminal. Describes text appearance (foreground and background colors, as well as other attributes such as bold) for an 8 color terminal.Style elements that apply in both 8 and 256 color terminals. However, the elements are described separately for 8 and 256 color terminals, so that the text appearance can change depending on how many colors a terminal has.EColor for an 256-color terminal. Does not affect 8-color terminals.hNothing indicates to use the default color for the terminal; otherwise, use the corresponding Terminfo .EColor for an 8-color terminal. Does not affect 256-color terminals.!hNothing indicates to use the default color for the terminal; otherwise, use the corresponding Terminfo ."&A simple enumeration for eight values.0LAny color for an 8-color terminal can also be used in a 256-color terminal.1 Creates a  from a strict - with default colors and no special effects.2 Creates a  from a list of strict - with default colors and no special effects.3 Creates a  from a lazy - with default colors and no special effects.4 Creates a  from a list of lazy - with default colors and no special effects.UBold. What actually happens when you use Bold is going to depend on your terminal. For example, xterm allows you actually use a bold font for bold, if you have one. Otherwise, it might simulate bold by using overstriking. Another possibility is that your terminal might use a different color to indicate bold. For more details (at least for xterm), look at xterm (1) and search for  boldColors.lIf your terminal uses a different color for bold, this allows an 8-color terminal to really have 16 colors.k  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghije  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdk.-,+"*)('&%$#/ !0j i hgf1234e56789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdH   !"*)('&%$#+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghij Safe-Inferred+0 kqChanging colors. Instances of this class affect the background or the foreground color. For example, to get a * that changes the background to red, use l ; for the foreground, use m f. Whether 8-color or 256-color terminals (or both) are affected depends on the particular instance.Because  is an instance of kt, you can use literals to affect the color of 256-color terminals. For example, if you have a 256 color terminal: =putChunkLn $ "muddy yellow background" <> back (100 :: Word8):This example would not affect an 8-color terminal, as the , instance affects 256-color terminals only.l Create a ( that affects the background color only.m Create a ( that affects the foreground color only.nA n5 affects both 8- and 256-color terminals. (It does not necessarily affect both the foreground and background; whether it affects the foreground, background, or both depends upon the context in which it is used.)qIf  , use the p color on 256-color terminals.rResets the color (foreground or background, as appropriate) to the default for your terminal. Usually you will not need this, as each / starts out with the terminal's default colors.{Resets the color (foreground or background, as appropriate) to the default for your terminal. Usually you will not need this, as each / starts out with the terminal's default colors.CA Radiant with the same color for both 8- and 256-color terminals.WA Radiant that uses the terminal's default colors for both 8- and 256-color terminals.=Affects the foreground and background of 256-color terminals.;Affects the foreground and background of 8-color terminals.JAffects the foreground and background of both 8- and 256-color terminals.(klmnopqrstuvwxyz{|}~#klmnopqrstuvwxyz{|}~(rstuvwxyz{|}~nopqklm#klmnopqrstuvwxyz{|}~ Safe-Inferred Convert a  to a list of .; do not show any colors. When applied to a +, this function returns a difference list. Convert a  to a list of ); show eight colors. When applied to a +, this function returns a difference list. Convert a  to a list of '; show 256 colors. When applied to a +, this function returns a difference list.*Spawns a subprocess to read the output of  tput colorsG. If this says there are at least 256 colors are available, returns A. Otherwise, if there are at least 8 colors available, returns . Otherwise, returns .HIf any IO exceptions arise during this process, they are discarded and  is returned.Like  but also consults a provided Handle . If the Handle is not a terminal, ( is returned. Otherwise, the value of  is returned.Convert a list of  to a list of U. The length of the returned list may be longer than the length of the input list.QSo, for example, to print a bunch of chunks to standard output using 256 colors: d{-# LANGUAGE OverloadedStrings #-} module PrintMyChunks where import qualified Data.ByteString as BS import Rainbow myChunks :: [Chunk] myChunks = [ "Roses" <> fore red, "\n", "Violets" <> fore blue, "\n" ] myPrintedChunks :: IO () myPrintedChunks = mapM_ BS.putStr . chunksToByteStrings toByteStringsColors256 $ myChunks@To use the highest number of colors that this terminal supports: myPrintedChunks' :: IO () myPrintedChunks' = do printer <- byteStringMakerFromEnvironment mapM_ BS.putStr . chunksToByteStrings printer $ myChunks Writes a ChunkD to standard output. Spawns a child process to read the output of  tput colors to determine how many colors to use, for every single chunk. Therefore, this is not going to win any speed awards. You are better off using  and the functions in Data.ByteString to print your Chunk%s if you are printing a lot of them. Writes a ChunkZ to standard output, and appends a newline. Spawns a child process to read the output of  tput colors to determine how many colors to use, for every single chunk. Therefore, this is not going to win any speed awards. You are better off using  and the functions in Data.ByteString to print your Chunk%s if you are printing a lot of them.5Function that converts  to %. This function, when applied to a , returns a difference list.555 Safe-Inferred^ !"#$%&'()*01234579;=?ACEGIKMOQSUWY[]_acklmnopqrstuvwxyz{|}~X1234UWY[]_ac579;=?ACEGIKMOQSklmnopq"*)('&%$# !rstuvwxyz{|}~0         !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmmnopqrstuvwxyz{|}~UWY[]_ac  rainbow-0.22.0.2 Rainbow.TypesRainbow.ColorsRainbow.TranslateTColorRainbowChunk chunkTextSpec chunkTextsTextSpecstyle8style256Style256 foreground256 background256 common256Style8 foreground8 background8common8 StyleCommonscBoldscFaintscItalic scUnderlinescBlink scInverse scInvisible scStrikeoutColor256 unColor256Color8unColor8Enum8E7E6E5E4E3E2E1E0 Foreground256 Foreground8 Background256 Background8 enum8toWord8to256 chunkFromTextchunkFromTextschunkFromLazyTextchunkFromLazyTextsbold8bold8offfaint8 faint8offitalic8 italic8off underline8 underline8offblink8 blink8offinverse8 inverse8off invisible8 invisible8off strikeout8 strikeout8offbold256 bold256offfaint256 faint256off italic256 italic256off underline256underline256offblink256 blink256off inverse256 inverse256off invisible256invisible256off strikeout256strikeout256offboldboldOfffaintfaintOffitalic italicOff underline underlineOffblinkblinkOffinverse inverseOff invisible invisibleOff strikeout strikeoutOff $fMonoidChunk$fIsStringChunk$fMonoidTextSpec$fMonoidStyle256$fMonoidStyle8$fMonoidStyleCommonbackforeRadiantrad8rad256noColor8black8red8green8yellow8blue8magenta8cyan8white8 noColor256grey brightRed brightGreen brightYellow brightBlue brightMagenta brightCyan brightWhitebothnoColorRadiantblackredgreenyellowbluemagentacyanwhite $fColorWord8 $fColorEnum8$fColorRadiant$fColorColor256 $fColorColor8singleescapecsisgrparams sgrSingle sgrDouble normalDefault foreBlackforeRed foreGreen foreYellowforeBlue foreMagentaforeCyan foreWhite foreDefault backBlackbackRed backGreen backYellowbackBlue backMagentabackCyan backWhite backDefaultfore256back256 foreColor8 backColor8 foreColor256 backColor256 styleCommon textSpec8 textSpec256toByteStringsColors0toByteStringsColors8toByteStringsColors256byteStringMakerFromEnvironmentbyteStringMakerFromHandlechunksToByteStringsputChunk putChunkLn text-1.2.0.4Data.Text.InternalTextData.Text.Internal.LazybaseGHC.WordWord8 Data.MaybeNothingbytestring-0.10.4.0Data.ByteString.Internal ByteString Data.Monoid<>memptyMonoid