package ocolor

  1. Overview
  2. Docs
type seq = int list

Until the last moment, it is more convenient to work with list of integers. It is easier to apply several styles at once, since a sequence can be the concatenation of several simple sequences. And, at the last moment, we translate it as the string sequence as it will be passed to the terminal.

val sgr_of_seq : seq -> string

Translate a list of integer to the corresponding escape sequence string. This is the list of integer separated by Ocolor_config.separator (by default ";"), surrounded by the appropriate prefix and suffix (resp. "\x1b[" and "m")

val code_of_color3 : Ocolor_types.color4 -> int
val fg_code_of_color4 : Ocolor_types.color4 -> int
val code_of_color8 : Ocolor_types.color8 -> int
val bg_code_of_color4 : Ocolor_types.color4 -> int

Parametric style sequences

Foreground color

Integer sequences
val default_fg_seq : seq
val fg_rgb_seq : int -> int -> int -> seq

Legal values for parameters are [0; 255].

val fg_color4_seq : Ocolor_types.color4 -> seq
val fg_color8_seq : Ocolor_types.color8 -> seq
val fg_color24_seq : Ocolor_types.color24 -> seq
val fg_color_seq : Ocolor_types.color -> seq
Escape sequences
val default_fg_sgr : string
val fg_rgb_sgr : int -> int -> int -> string

Legal values for parameters are [0; 255].

val fg_color4_sgr : Ocolor_types.color4 -> string
val fg_color8_sgr : Ocolor_types.color8 -> string
val fg_color24_sgr : Ocolor_types.color24 -> string

Background color

Integer sequences
val default_bg_seq : seq
val bg_rgb_seq : int -> int -> int -> seq

Legal values for parameters are [0; 255].

val bg_color4_seq : Ocolor_types.color4 -> seq
val bg_color8_seq : Ocolor_types.color8 -> seq
val bg_color24_seq : Ocolor_types.color24 -> seq
Escape sequences
val default_bg_sgr : string
val bg_rgb_sgr : int -> int -> int -> string

Legal values for parameters are [0; 255].

val bg_color4_sgr : Ocolor_types.color4 -> string
val bg_color8_sgr : Ocolor_types.color8 -> string
val bg_color24_sgr : Ocolor_types.color24 -> string
val bg_color_seq : Ocolor_types.color -> seq

Font

Integer sequences
val font_seq : int -> seq

Legal values for parameter are [1; 9]

val default_font_seq : seq
Escape sequences
val font_sgr : int -> string

Legal values for parameters are [1; 9]

val default_font_sgr : string

Non parametric style sequences

SGR sequences of common styles as int list

val reset_seq : seq
val bold_seq : seq
val faint_seq : seq
val italic_seq : seq
val underlined_seq : seq
val reverse_video_seq : seq
val conceal_seq : seq
val crossed_out_seq : seq
val fraktur_seq : seq
val double_underlined_seq : seq
val faint_bold_off_seq : seq
val italic_fraktur_off_seq : seq
val underlined_off_seq : seq
val reverse_video_off_seq : seq
val concel_off_seq : seq
val crossed_out_off_seq : seq
val framed_seq : seq
val encircled_seq : seq
val overlined_seq : seq
val framed_encircled_off_seq : seq
val overlined_off_seq : seq

String SGR sequences of common styles

val reset_sgr : string
val bold_sgr : string
val double_underlined_sgr : string
val faint_sgr : string
val faint_bold_off_sgr : string
val italic_sgr : string
val italic_fraktur_off_sgr : string
val fraktur_sgr : string
val underlined_sgr : string
val underlined_off_sgr : string
val reverse_video_sgr : string
val reverse_video_off_sgr : string
val conceal_sgr : string
val concel_off_sgr : string
val crossed_out_sgr : string
val crossed_out_off_sgr : string
val framed_sgr : string
val framed_encircled_off_sgr : string
val encircled_sgr : string
val overlined_sgr : string
val overlined_off_sgr : string

Integer and escape sequence for arbitrary style

val seq_of_style : Ocolor_types.style -> seq
val sgr_of_style : Ocolor_types.style -> string
val seq_of_styles : Ocolor_types.style list -> seq
val styles_sgr : Ocolor_types.style list -> string
OCaml

Innovation. Community. Security.