Styled text.
Type of a string with styles for each characters.
Creates a styled string from a string. All characters of the
string have no style. The string may contain invalid UTF-8
sequences, in which case invalid bytes are escaped with the
syntax \yXX
.
stylise string style
creates a styled string with all styles
set to style
.
stylise_parenthesis text ?paren pos style
searchs for
parenthesis group starting or ending at pos
and apply them the
style style
. paren
is the list of parenthesis recognized.
Markup strings are used to conveniently define styled strings.
(* | A UTF-8 encoded string. | *) | |
(* | A rope. | *) | |
#
| B_bold of bool
| (* | Begins bold mode. | *) |
#
| E_bold
| (* | Ends bold mode. | *) |
#
| B_underline of bool
| (* | Begins underlined mode. | *) |
#
| E_underline
| (* | Ends underlined mode. | *) |
#
| B_blink of bool
| (* | Begins blinking mode. | *) |
#
| E_blink
| (* | Ends blinking mode. | *) |
#
| B_reverse of bool
| (* | Begins reverse video mode. | *) |
#
| E_reverse
| (* | Ends reverse video mode. | *) |
(* | Begins foreground color. | *) | |
#
| E_fg
| (* | Ends foreground color. | *) |
(* | Begins background color. | *) | |
#
| E_bg
| (* | Ends background color. | *) |
Type of an item in a markup string.
Create a formatter on a styled string. Returns a tuple get_content, fmt
. Calling get_content ()
will flush the formatter and output the resulting styled string.
If a read_color
function is provided, Format's tag are enabled and read_color
is used to transform tags into styles.
pp_with_style f
will create a pretty printer analogous to stylise, using f to encode style into tags. Will only work on a formatter with tag enabled.