Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
The innards of Rainbow. Ordinarily you should not need this module; instead, just import Rainbow, which re-exports the most useful names from this module.
- type Background8 = Last Color8
- type Background256 = Last Color256
- type Foreground8 = Last Color8
- type Foreground256 = Last Color256
- data Enum8
- enum8toWord8 :: Enum8 -> Word8
- newtype Color8 = Color8 {}
- newtype Color256 = Color256 {
- unColor256 :: Maybe Word8
- to256 :: Color8 -> Color256
- data StyleCommon = StyleCommon {}
- data Style8 = Style8 {}
- data Style256 = Style256 {}
- data TextSpec = TextSpec {}
- data Chunk = Chunk {
- chunkTextSpec :: TextSpec
- chunkTexts :: [Text]
- chunkFromText :: Text -> Chunk
- chunkFromTexts :: [Text] -> Chunk
- chunkFromLazyText :: Text -> Chunk
- chunkFromLazyTexts :: [Text] -> Chunk
- bold8 :: Chunk
- bold8off :: Chunk
- faint8 :: Chunk
- faint8off :: Chunk
- italic8 :: Chunk
- italic8off :: Chunk
- underline8 :: Chunk
- underline8off :: Chunk
- blink8 :: Chunk
- blink8off :: Chunk
- inverse8 :: Chunk
- inverse8off :: Chunk
- invisible8 :: Chunk
- invisible8off :: Chunk
- strikeout8 :: Chunk
- strikeout8off :: Chunk
- bold256 :: Chunk
- bold256off :: Chunk
- faint256 :: Chunk
- faint256off :: Chunk
- italic256 :: Chunk
- italic256off :: Chunk
- underline256 :: Chunk
- underline256off :: Chunk
- blink256 :: Chunk
- blink256off :: Chunk
- inverse256 :: Chunk
- inverse256off :: Chunk
- invisible256 :: Chunk
- invisible256off :: Chunk
- strikeout256 :: Chunk
- strikeout256off :: Chunk
- bold :: Chunk
- boldOff :: Chunk
- faint :: Chunk
- faintOff :: Chunk
- italic :: Chunk
- italicOff :: Chunk
- underline :: Chunk
- underlineOff :: Chunk
- blink :: Chunk
- blinkOff :: Chunk
- inverse :: Chunk
- inverseOff :: Chunk
- invisible :: Chunk
- invisibleOff :: Chunk
- strikeout :: Chunk
- strikeoutOff :: Chunk
Documentation
type Background8 = Last Color8 Source
type Background256 = Last Color256 Source
type Foreground8 = Last Color8 Source
type Foreground256 = Last Color256 Source
A simple enumeration for eight values.
enum8toWord8 :: Enum8 -> Word8 Source
Color for an 8-color terminal. Does not affect 256-color terminals.
Color for an 256-color terminal. Does not affect 8-color terminals.
Color256 | |
|
to256 :: Color8 -> Color256 Source
Any color for an 8-color terminal can also be used in a 256-color terminal.
data StyleCommon Source
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.
Describes text appearance (foreground and background colors, as well as other attributes such as bold) for an 8 color terminal.
Describes text appearance (foreground and background colors, as well as other attributes such as bold) for a 256 color terminal.
The TextSpec bundles together the styles for the 8 and 256 color terminals, so that the text can be portrayed on any terminal.
A 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.
Chunk | |
|
chunkFromText :: Text -> Chunk Source
chunkFromTexts :: [Text] -> Chunk Source
chunkFromLazyText :: Text -> Chunk Source
chunkFromLazyTexts :: [Text] -> Chunk Source
Bold. 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
.
If your terminal uses a different color for bold, this allows an 8-color terminal to really have 16 colors.