package ocolor
Install
dune-project
Dependency
Authors
Maintainers
Sources
md5=094b701f30af41b89f554e978cb0762c
sha512=b558fb735d28c262b0cf047835df2bc59e89daf44fbaf55b3d73293457713cb2a45805965f4bd6aafac1e7bc6325b3e70ec59d3e4a096b25e99072fee68ac8ce
doc/ocolor/Ocolor_printf/index.html
Module Ocolor_printf
Printf-friendly functions
These functions are useful when trying to print with styles with Printf. However, they are a very bad choice. They perform a context-free formatting. For instance, there is no way to end the current style and restore the previous, like stack-base functions of Ocolor_format do. They just print the desired style and keep no track of the current state.
Thus, it's better to use Ocolor_format as much as possible. Moreover, Format provide a nice way of composing printers with %a and Format.asprintf. Even if you don't like boxes, Format.asprintf and semantic tags are cool.
So, here are the Printf-friendly functions. Use with care, and preferably, not at all.
fprintf
%a
val apply_style : out_channel -> Ocolor_types.style -> unitval apply_styles : out_channel -> Ocolor_types.style list -> unitval fg_color4 : out_channel -> Ocolor_types.color4 -> unitval fg_color8 : out_channel -> Ocolor_types.color8 -> unitval fg_color24 : out_channel -> Ocolor_types.color24 -> unitval bg_color4 : out_channel -> Ocolor_types.color4 -> unitval bg_color8 : out_channel -> Ocolor_types.color8 -> unitval bg_color24 : out_channel -> Ocolor_types.color24 -> unit%t
val default_fg : out_channel -> unitval fg_rgb : int -> int -> int -> out_channel -> unitval default_bg : out_channel -> unitval bg_rgb : int -> int -> int -> out_channel -> unitval reset : out_channel -> unitsprintf
%a
val s_apply_style : unit -> Ocolor_types.style -> stringval s_apply_styles : unit -> Ocolor_types.style list -> stringPrintf-like
Just like printf but perform automatic reset after printing if Ocolor_config.auto_reset is set
val fprintf : out_channel -> ('a, out_channel, unit) format -> 'aval kfprintf :
(out_channel -> unit) ->
out_channel ->
('a, out_channel, unit) format ->
'aval sprintf : ('a, unit, string, string) format4 -> 'aval printf : ('a, out_channel, unit) format -> 'aval kprintf : (out_channel -> unit) -> ('a, out_channel, unit) format -> 'aHandy printers
val pp_bool_generic :
?false_style:Ocolor_types.style list ->
?true_style:Ocolor_types.style list ->
out_channel ->
bool ->
unitval pp_bool : out_channel -> bool -> unitval pp_list_generic :
?left:string ->
?sep:string ->
?right:string ->
?delim_style:Ocolor_types.style list ->
?sep_style:Ocolor_types.style list ->
?elem_style:Ocolor_types.style list ->
(out_channel -> 'a -> unit) ->
out_channel ->
'a list ->
unitval pp_list : (out_channel -> 'a -> unit) -> out_channel -> 'a list -> unitval pp_option_generic :
?none:string ->
?none_style:Ocolor_types.style list ->
?some_style:Ocolor_types.style list ->
(out_channel -> 'a -> unit) ->
out_channel ->
'a option ->
unitval pp_option : (out_channel -> 'a -> unit) -> out_channel -> 'a option -> unitval pp_pair_generic :
?left:string ->
?sep:string ->
?right:string ->
?delim_style:Ocolor_types.style list ->
?sep_style:Ocolor_types.style list ->
?elem_style:Ocolor_types.style list ->
(out_channel -> 'a -> unit) ->
(out_channel -> 'b -> unit) ->
out_channel ->
('a * 'b) ->
unitval pp_pair :
(out_channel -> 'a -> unit) ->
(out_channel -> 'b -> unit) ->
out_channel ->
('a * 'b) ->
unitval pp_3_tuple_generic :
?left:string ->
?sep:string ->
?right:string ->
?delim_style:Ocolor_types.style list ->
?sep_style:Ocolor_types.style list ->
?elem_style:Ocolor_types.style list ->
(out_channel -> 'a -> unit) ->
(out_channel -> 'b -> unit) ->
(out_channel -> 'c -> unit) ->
out_channel ->
('a * 'b * 'c) ->
unitval pp_3_tuple :
(out_channel -> 'a -> unit) ->
(out_channel -> 'b -> unit) ->
(out_channel -> 'c -> unit) ->
out_channel ->
('a * 'b * 'c) ->
unitval pp_4_tuple_generic :
?left:string ->
?sep:string ->
?right:string ->
?delim_style:Ocolor_types.style list ->
?sep_style:Ocolor_types.style list ->
?elem_style:Ocolor_types.style list ->
(out_channel -> 'a -> unit) ->
(out_channel -> 'b -> unit) ->
(out_channel -> 'c -> unit) ->
(out_channel -> 'd -> unit) ->
out_channel ->
('a * 'b * 'c * 'd) ->
unitval pp_4_tuple :
(out_channel -> 'a -> unit) ->
(out_channel -> 'b -> unit) ->
(out_channel -> 'c -> unit) ->
(out_channel -> 'd -> unit) ->
out_channel ->
('a * 'b * 'c * 'd) ->
unitval pp_5_tuple_generic :
?left:string ->
?sep:string ->
?right:string ->
?delim_style:Ocolor_types.style list ->
?sep_style:Ocolor_types.style list ->
?elem_style:Ocolor_types.style list ->
(out_channel -> 'a -> unit) ->
(out_channel -> 'b -> unit) ->
(out_channel -> 'c -> unit) ->
(out_channel -> 'd -> unit) ->
(out_channel -> 'e -> unit) ->
out_channel ->
('a * 'b * 'c * 'd * 'e) ->
unitval pp_5_tuple :
(out_channel -> 'a -> unit) ->
(out_channel -> 'b -> unit) ->
(out_channel -> 'c -> unit) ->
(out_channel -> 'd -> unit) ->
(out_channel -> 'e -> unit) ->
out_channel ->
('a * 'b * 'c * 'd * 'e) ->
unit