Module Pp_tty.Style

Symbolic styles that can be used inside messages. These styles are later converted to actual concrete styles depending on the output device. For instance, when printed to the terminal they are converted to ansi terminal styles (Ansi_color.Style.t list values).

In addition to the symbolic styles inherited from Stdune.User_message.Style, this type includes tags that carry original structured data. These allow round-tripping between Pp_tty.t and structured representations such as Sexp.t or Dyn.t without lossy string rendering.

type t =
  1. | Loc
  2. | Error
  3. | Warning
  4. | Kwd
  5. | Id
  6. | Prompt
  7. | Hint
  8. | Details
  9. | Ok
  10. | Debug
  11. | Success
  12. | Ansi_styles of Ansi_color.Style.t list
  13. | Original_sexp of Sexplib0.Sexp.t
  14. | Original_dyn of Dyn.t
val to_dyn : t -> Dyn.t
val compare : t -> t -> Ordering.t
val of_stdune : Stdune.User_message.Style.t -> t

Convert from Stdune.User_message.Style.t. This is a total injection (all Stdune constructors are preserved).

val to_stdune : t -> Stdune.User_message.Style.t option

Convert to Stdune.User_message.Style.t. The new structured-data tags (Original_sexp, Original_dyn) have no equivalent in Stdune and return None, causing the tag to be stripped when used with Pp.filter_map_tags.