Skip to content

Commit

Permalink
add support of dim/faint (#8)
Browse files Browse the repository at this point in the history
Signed-off-by: Ali Caglayan <[email protected]>
Co-authored-by: favonia <[email protected]>
  • Loading branch information
Alizter and favonia authored Oct 11, 2023
1 parent bb4ab8e commit b6e1036
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
21 changes: 12 additions & 9 deletions examples/colors.ml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,18 @@ let colors = A.[
]

let styles = A.[
"empty" , empty
; "bold" , st bold
; "italic" , st italic
; "underline" , st underline
; "blink" , st blink
; "reverse" , st reverse
; "bold/italic", st bold ++ st italic
; "rev/underln", st underline ++ st reverse
; "bold/rev" , st reverse ++ st bold
"empty" , empty
; "bold" , st bold
; "faint" , st faint
; "italic" , st italic
; "underline" , st underline
; "blink" , st blink
; "reverse" , st reverse
; "bold/italic" , st bold ++ st italic
; "faint/italic", st faint ++ st italic
; "rev/underln" , st underline ++ st reverse
; "bold/rev" , st reverse ++ st bold
; "faint/rev" , st reverse ++ st faint
]

let image w =
Expand Down
13 changes: 7 additions & 6 deletions src/notty.ml
Original file line number Diff line number Diff line change
Expand Up @@ -209,11 +209,12 @@ module A = struct
and b x = x land 0xff

let bold = 1
and italic = 2
and dim = 3
and underline = 4
and blink = 8
and reverse = 16
and dim = 2
and faint = 2
and italic = 4
and underline = 8
and blink = 16
and reverse = 32

let empty = { fg = 0; bg = 0; st = 0 }

Expand Down Expand Up @@ -511,7 +512,7 @@ module Cap = struct

let ((<|), (<.), (<!)) = Buffer.(add_string, add_char, add_decimal)

let sts = [ ";1"; ";3"; ";4"; ";5"; ";7" ]
let sts = [ ";1"; ";2"; ";3"; ";4"; ";5"; ";7" ]

let sgr { A.fg; bg; st } buf =
buf <| "\x1b[0";
Expand Down
3 changes: 2 additions & 1 deletion src/notty.mli
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,9 @@ module A : sig
(** Additional text properties. *)

val bold : style
val italic : style
val dim : style
val faint : style
val italic : style
val underline : style
val blink : style
val reverse : style
Expand Down

0 comments on commit b6e1036

Please sign in to comment.