Browse Source

Styling (bold/underline) is now working

Leo 10 years ago
parent
commit
8352652d2c
1 changed files with 8 additions and 10 deletions
  1. 8 10
      src/messages.ml

+ 8 - 10
src/messages.ml

@@ -62,23 +62,21 @@ type style =
 (* General function to print things *)
 (* General function to print things *)
 let print ~color ~style message =
 let print ~color ~style message =
     let open Core_extended in
     let open Core_extended in
-    (* This module create proper escapement to display text with bold/color... *)
-    (* Define style and then color, color only works *)
-    style |>
+    (* This code create proper escapement to display text with bold/color... *)
+    color |>
     (function
     (function
-        | Bold -> Color_print.bold message
-        | Underline -> Color_print.underline message
-        | Normal -> Color_print.normal message
-    ) |>
-    (fun styled_message ->
-        match color with
         | Green -> Color_print.color ~color:`Green message
         | Green -> Color_print.color ~color:`Green message
         | Red -> Color_print.color ~color:`Red message
         | Red -> Color_print.color ~color:`Red message
         | Yellow -> Color_print.color ~color:`Yellow message
         | Yellow -> Color_print.color ~color:`Yellow message
         | White -> Color_print.color ~color:`White message
         | White -> Color_print.color ~color:`White message
         | Plum -> Color_print.color ~color:`Plum message
         | Plum -> Color_print.color ~color:`Plum message
     ) |> (* Finaly print escaped string *)
     ) |> (* Finaly print escaped string *)
-    printf "%s"
+    (fun colored_msg ->
+        match style with
+        | Bold -> Color_print.boldprintf "%s" colored_msg
+        | Underline -> Color_print.underlineprintf "%s" colored_msg
+        | Normal -> printf "%s" colored_msg
+    )
 ;;
 ;;
 
 
 (* Print debugging, information, important... messages *)
 (* Print debugging, information, important... messages *)