aboutsummaryrefslogtreecommitdiffhomepage
path: root/lib
diff options
context:
space:
mode:
authorGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2015-05-14 12:49:41 +0200
committerGravatar Pierre-Marie Pédrot <pierre-marie.pedrot@inria.fr>2015-05-14 13:02:17 +0200
commit5f8dc36fb2d65699233b9ac9a3ff9f93701a01cb (patch)
tree57855137873a81f1b026b8be73560c71a9915acb /lib
parent81eb133d64ac81cbf6962d624b20c1aa55c2baae (diff)
The -list-tag options now prints the corresponding COQ_COLORS value.
Diffstat (limited to 'lib')
-rw-r--r--lib/terminal.ml7
-rw-r--r--lib/terminal.mli3
2 files changed, 8 insertions, 2 deletions
diff --git a/lib/terminal.ml b/lib/terminal.ml
index 0f6b23af3..58851ed27 100644
--- a/lib/terminal.ml
+++ b/lib/terminal.ml
@@ -117,7 +117,7 @@ let is_extended = function
| `INDEX _ | `RGB _ -> true
| _ -> false
-let eval st =
+let repr st =
let fg = match st.fg_color with
| None -> []
| Some c ->
@@ -152,7 +152,10 @@ let eval st =
| Some true -> [7]
| Some false -> [27]
in
- let tags = fg @ bg @ bold @ italic @ underline @ negative in
+ fg @ bg @ bold @ italic @ underline @ negative
+
+let eval st =
+ let tags = repr st in
let tags = List.map string_of_int tags in
Printf.sprintf "\027[%sm" (String.concat ";" tags)
diff --git a/lib/terminal.mli b/lib/terminal.mli
index f308ede32..49172e3ce 100644
--- a/lib/terminal.mli
+++ b/lib/terminal.mli
@@ -46,6 +46,9 @@ val make : ?fg_color:color -> ?bg_color:color ->
val merge : style -> style -> style
(** [merge s1 s2] returns [s1] with all defined values of [s2] overwritten. *)
+val repr : style -> int list
+(** Generate the ANSI code representing the given style. *)
+
val eval : style -> string
(** Generate an escape sequence from a style. *)