Skip to content

Commit

Permalink
feature: italicise "Hint" in User_message (#6685)
Browse files Browse the repository at this point in the history
We also add italic to ansi_color.

Signed-off-by: Ali Caglayan <[email protected]>
  • Loading branch information
Alizter authored Dec 13, 2022
1 parent 82d2518 commit 617ad4b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
2 changes: 2 additions & 0 deletions otherlibs/stdune/ansi_color.ml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ module Style = struct

let dim = "2"

let italic = "3"

let underlined = "4"

let escape_sequence l =
Expand Down
2 changes: 2 additions & 0 deletions otherlibs/stdune/ansi_color.mli
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ module Style : sig

val dim : t

val italic : t

val underlined : t

(** Ansi escape sequence that set the terminal style to exactly these styles *)
Expand Down
5 changes: 4 additions & 1 deletion otherlibs/stdune/user_message.ml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ module Style = struct
| Kwd
| Id
| Prompt
| Hint
| Details
| Ok
| Debug
Expand Down Expand Up @@ -34,6 +35,7 @@ module Print_config = struct
| Kwd -> [ bold; fg_blue ]
| Id -> [ bold; fg_yellow ]
| Prompt -> [ bold; fg_green ]
| Hint -> [ italic; fg_white ]
| Details -> [ dim; fg_white ]
| Ok -> [ dim; fg_green ]
| Debug -> [ underlined; fg_bright_cyan ]
Expand Down Expand Up @@ -73,7 +75,8 @@ let pp { loc; paragraphs; hints; annots = _ } =
| [] -> paragraphs
| _ ->
List.append paragraphs
(List.map hints ~f:(fun hint -> Pp.verbatim "Hint:" ++ Pp.space ++ hint))
(List.map hints ~f:(fun hint ->
Pp.tag Style.Hint (Pp.verbatim "Hint:") ++ Pp.space ++ hint))
in
let paragraphs = List.map paragraphs ~f:Pp.box in
let paragraphs =
Expand Down
1 change: 1 addition & 0 deletions otherlibs/stdune/user_message.mli
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module Style : sig
| Kwd
| Id
| Prompt
| Hint
| Details
| Ok
| Debug
Expand Down

0 comments on commit 617ad4b

Please sign in to comment.