diff options
| author | Jon French | 2018-03-12 17:44:26 +0000 |
|---|---|---|
| committer | Jon French | 2018-03-12 17:45:53 +0000 |
| commit | a6d59b97a4840b81481751e0e05b1da9ed28de86 (patch) | |
| tree | 0ca32b37f3648d2f33e555bc2d048c8da7523d46 /src/lem_interp | |
| parent | 9570bf932e3ba0269cbed06a49fc8000b45b32a3 (diff) | |
lem_interp: expose disable color flag in Printing_functions interface
Diffstat (limited to 'src/lem_interp')
| -rw-r--r-- | src/lem_interp/printing_functions.ml | 3 | ||||
| -rw-r--r-- | src/lem_interp/printing_functions.mli | 1 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/lem_interp/printing_functions.ml b/src/lem_interp/printing_functions.ml index a096b27b..a5cb96ff 100644 --- a/src/lem_interp/printing_functions.ml +++ b/src/lem_interp/printing_functions.ml @@ -402,6 +402,9 @@ let ppmode = ref Interp_ascii let set_interp_ppmode ppm = ppmode := ppm let disable_color = ref false + +let set_color_enabled on = disable_color := not on + let color bright code s = if !disable_color then s else sprintf "\x1b[%s3%dm%s\x1b[m" (if bright then "1;" else "") code s diff --git a/src/lem_interp/printing_functions.mli b/src/lem_interp/printing_functions.mli index f1a0cd4a..908d101d 100644 --- a/src/lem_interp/printing_functions.mli +++ b/src/lem_interp/printing_functions.mli @@ -26,6 +26,7 @@ type ppmode = | Interp_ascii | Interp_html val set_interp_ppmode : ppmode -> unit +val set_color_enabled : bool -> unit val red : string -> string val blue : string -> string |
