Functions to wrap strings in ANSI Escape sequences for colors and styling.
plain : String -> String
Display the text in the console's default style.
dark : String -> String
Make the text darker.
This can be used with other text modifiers, such as color.
import Console exposing (dark, green)
-- "Hello, dark green world!" with "dark green" in dark green
greeting : String
greeting =
"Hello, " ++ (dark << green) "dark green" ++ " world!"
Not all terminals support this.
bold : String -> String
Make the text bold.
This can be used with other text modifiers, such as color.
import Console exposing (blue, bold)
-- "Hello, bold blue world!" with "bold blue" in bold and blue
greeting : String
greeting =
"Hello, " ++ (bold << blue) "bold blue" ++ " world!"
Some terminals implement this as a color change rather than a boldness change.
underline : String -> String
Make the text underlined.
This can be used with other text modifiers, such as color.
import Console exposing (underline)
-- "This will look like a hyperlink" with "hyperlink" underlined
example : String
example =
"This will look like a " ++ underline "hyperlink"
Not all terminals support this.
colorsInverted : String -> String
Invert the foreground and background colors from what they would otherwise be.
black : String -> String
Make the foreground text black.
red : String -> String
Make the foreground text red.
green : String -> String
Make the foreground text green.
yellow : String -> String
Make the foreground text yellow.
blue : String -> String
Make the foreground text blue.
magenta : String -> String
Make the foreground text magenta.
cyan : String -> String
Make the foreground text cyan.
white : String -> String
Make the foreground text white.
bgBlack : String -> String
Make the background black.
bgRed : String -> String
Make the background red.
bgGreen : String -> String
Make the background green.
bgYellow : String -> String
Make the background yellow.
bgBlue : String -> String
Make the background blue.
bgMagenta : String -> String
Make the background magenta.
bgCyan : String -> String
Make the background cyan.
bgWhite : String -> String
Make the background white.