aboutsummaryrefslogtreecommitdiff
path: root/toplevel/coqtop.ml
diff options
context:
space:
mode:
Diffstat (limited to 'toplevel/coqtop.ml')
-rw-r--r--toplevel/coqtop.ml30
1 files changed, 27 insertions, 3 deletions
diff --git a/toplevel/coqtop.ml b/toplevel/coqtop.ml
index 35d68603aa..01eaccd2bb 100644
--- a/toplevel/coqtop.ml
+++ b/toplevel/coqtop.ml
@@ -42,9 +42,33 @@ let print_header () =
let warning s = msg_warning (strbrk s)
let toploop = ref None
-let toploop_init = ref (fun x ->
- CoqworkmgrApi.(init !Flags.async_proofs_worker_priority);
- x)
+
+let toploop_init = ref begin fun x ->
+ let () =
+ if
+ Terminal.has_style Unix.stdout &&
+ Terminal.has_style Unix.stderr &&
+ not (!Flags.print_emacs)
+ then begin
+ let colors = try Some (Sys.getenv "COQ_COLORS") with Not_found -> None in
+ match colors with
+ | None ->
+ (** Default colors *)
+ Ppstyle.init_color_output ()
+ | Some "" ->
+ (** No color output *)
+ ()
+ | Some s ->
+ (** Overwrite all colors *)
+ Ppstyle.clear_styles ();
+ Ppstyle.parse_config s;
+ Ppstyle.init_color_output ()
+ end
+ in
+ let () = CoqworkmgrApi.(init !Flags.async_proofs_worker_priority) in
+ x
+ end
+
let toploop_run = ref (fun () ->
if Dumpglob.dump () then begin
if_verbose warning "Dumpglob cannot be used in interactive mode.";