Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d7bc97
commit 4e1cf76
Showing
6 changed files
with
194 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,48 @@ | ||
module System.Console.ANSI.Common where | ||
|
||
-- | ANSI colors: come in various intensities, which are controlled by 'ANSISGR' | ||
data ANSIColor = Black | ||
| Red | ||
| Green | ||
| Yellow | ||
| Blue | ||
| Magenta | ||
| Cyan | ||
| White | ||
deriving (Bounded, Enum, Show) | ||
|
||
-- | ANSI colors: come in various intensities, which are controlled by 'ColorIntensity' | ||
data Color = Black | ||
| Red | ||
| Green | ||
| Yellow | ||
| Blue | ||
| Magenta | ||
| Cyan | ||
| White | ||
deriving (Bounded, Enum, Show) | ||
|
||
-- | ANSI colors come in two intensities | ||
data ColorIntensity = Dull | ||
| Vivid | ||
deriving (Enum, Show) | ||
|
||
-- | ANSI colors can be set on two different layers | ||
data ConsoleLayer = Foreground | ||
| Background | ||
deriving (Enum, Show) | ||
|
||
-- | ANSI blink speeds: values other than 'NoBlink' are not widely supported | ||
data BlinkSpeed = SlowBlink -- ^ Less than 150 blinks per minute | ||
| RapidBlink -- ^ More than 150 blinks per minute | ||
| NoBlink | ||
|
||
-- | ANSI text underlining | ||
data Underlining = SingleUnderline | ||
| DoubleUnderline -- ^ Not widely supported | ||
| NoUnderline | ||
|
||
-- | ANSI general console intensity: usually treated as setting the font style (e.g. 'BoldIntensity' causes text to be bold) | ||
data ConsoleIntensity = BoldIntensity | ||
| FaintIntensity -- ^ Not widely supported: sometimes treated as concealing text | ||
| NormalIntensity | ||
|
||
-- | ANSI Select Graphic Rendition command | ||
data ANSISGR = Reset | ||
| BoldIntensity | ||
| FaintIntensity -- ^ Not widely supported: sometimes treated as conceal | ||
| NormalIntensity | ||
| Italic -- ^ Not widely supported: sometimes treated as swapping foreground and background | ||
| SingleUnderline | ||
| DoubleUnderline -- ^ Not widely supported | ||
| NoUnderline | ||
| SlowBlink | ||
| RapidBlink | ||
| NoBlink | ||
| Conceal -- ^ Not widely supported | ||
| Reveal | ||
| SwapForegroundBackground | ||
| DontSwapForegroundBackground | ||
| ForegroundNormalIntensity ANSIColor | ||
| ForegroundHighIntensity ANSIColor | ||
| BackgroundNormalIntensity ANSIColor | ||
| BackgroundHighIntensity ANSIColor | ||
data SGR = Reset | ||
| SetConsoleIntensity ConsoleIntensity | ||
| SetItalicized Bool -- ^ Not widely supported: sometimes treated as swapping foreground and background | ||
| SetUnderlining Underlining | ||
| SetBlinkSpeed BlinkSpeed | ||
| SetVisible Bool -- ^ Not widely supported | ||
| SetSwapForegroundBackground Bool | ||
| SetColor ConsoleLayer ColorIntensity Color |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.