package coq-core

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type
type color = [
  1. | `DEFAULT
  2. | `BLACK
  3. | `RED
  4. | `GREEN
  5. | `YELLOW
  6. | `BLUE
  7. | `MAGENTA
  8. | `CYAN
  9. | `WHITE
  10. | `LIGHT_BLACK
  11. | `LIGHT_RED
  12. | `LIGHT_GREEN
  13. | `LIGHT_YELLOW
  14. | `LIGHT_BLUE
  15. | `LIGHT_MAGENTA
  16. | `LIGHT_CYAN
  17. | `LIGHT_WHITE
  18. | `INDEX of int
  19. | `RGB of int * int * int
]
type style = {
  1. fg_color : color option;
  2. bg_color : color option;
  3. bold : bool option;
  4. italic : bool option;
  5. underline : bool option;
  6. negative : bool option;
  7. prefix : string option;
  8. suffix : string option;
}
val make : ?fg_color:color -> ?bg_color:color -> ?bold:bool -> ?italic:bool -> ?underline:bool -> ?negative:bool -> ?style:style -> ?prefix:string -> ?suffix:string -> unit -> style

Create a style from the given flags. It is derived from the optional style argument if given.

val merge : style -> style -> style

merge s1 s2 returns s1 with all defined values of s2 overwritten.

val diff : style -> style -> style

diff s1 s2 returns the differences between s1 and s2.

val repr : style -> int list

Generate the ANSI code representing the given style.

val eval : style -> string

Generate an escape sequence from a style.

val reset : string

This escape sequence resets all attributes.

val reset_style : style

The default style

val has_style : Unix.file_descr -> bool

Whether an output file descriptor handles styles. Very heuristic, only checks it is a terminal.

val parse : string -> (string * style) list

Parse strings describing terminal styles in the LS_COLORS syntax. For robustness, ignore meaningless entries and drops undefined styles.

OCaml

Innovation. Community. Security.