PrettyFunctions for pretty ascii output (colors, etc.)
By default a set of tags are added to stdout and stderr. To activate them call Format.pp_set_tags fmt true. Colors can be added to another formatter with the function add_colors.
Tags must be added to the format string with @{<tag> what you want@}. They can be arbitrarily nested. For instance to print a string in red with part of it bold do
Format.printf "@{<red>I'm red. @{<b> I'm bold red.@}@}"The font tags available are:
n : normalb : bold/b : cancel bolddim : dimmer coloru : underline/u : cancel underlinei : italicize/i : cancel italicize/bl : cancel blinkingThe color (foreground) tags are:
blackredgreenyellowbluemagentacyangraydefaultc:0-255 give directly the color number on 256 colors terminalsAnd their bright version
black_bred_bgreen_byellow_bblue_bmagenta_bcyan_bgray_bdefault_bThe background color tags are:
bg_blackbg_redbg_greenbg_yellowbg_bluebg_magentabg_cyanbg_graybg_defaultAnd their bright version
bg_black_bbg_red_bbg_green_bbg_yellow_bbg_blue_bbg_magenta_bbg_cyan_bbg_gray_bbg_default_b