Module Ansi_text.StyleSource

include module type of Style
Sourcetype t = Attr.t list

Models an ANSI escape sequence that can modify several attributes.

include Ppx_compare_lib.Comparable.S with type t := t
Sourceval compare : t -> t -> int
include Ppx_compare_lib.Equal.S with type t := t
Sourceval equal : t -> t -> bool
include Ppx_compare_lib.Equal.S__local with type t := t
include Ppx_quickcheck_runtime.Quickcheckable.S with type t := t
Sourceval quickcheck_generator : t Base_quickcheck.Generator.t
Sourceval quickcheck_observer : t Base_quickcheck.Observer.t
Sourceval quickcheck_shrinker : t Base_quickcheck.Shrinker.t
include Sexplib0.Sexpable.S with type t := t
include Sexplib0.Sexpable.Of_sexp with type t := t
Sourceval t_of_sexp : Sexplib0.Sexp.t -> t
include Sexplib0.Sexpable.Sexp_of with type t := t
Sourceval sexp_of_t : t -> Sexplib0.Sexp.t
Sourceval turn_off : t -> t

Gives a style that turns off all attributes that are turned on by the given style.

Sourceval of_sgr_params : int option list -> t

Make a Style.t from parsed CSI parameters. For example the parser, when handling:

"\027[1;38;5;1m"

would invoke:

of_sgr_params [Some 1; Some 38; Some 5; Some 1]

yielding:

[Bold; Fg Red]
Sourceval to_string : t -> string

Converts a Style.t to a string. For example

[Bold; Fg Standard Red] -> "\027[1;31m"
Sourceval compress : t -> t

Simplifies a Style.t by removing redundant attributes. For example Bold; Bg Blue; Reset; Fg Red; Fg Green -> Reset; Fg Green. This runs in O(n^2) time, but should be ok since Style lists are generally short.

Sourceval update : old_style:t -> added_style:t -> t

Style that results from applying added_style when old_style is already active.

Sourceval delta : old_style:t -> added_style:t -> t

A minimal style that would transition the active state from old_style to old_style + additional_style.

Sourceval to_string_hum : t -> string

Lists the attributes in a somewhat human-readable style.

Sourceval includes_reset : t -> bool

Whether any of the attributes are Reset.

Sourceval is_reset : t -> bool

Whether final attribute is Reset.

Sourceval closes : new_style:t -> old_style:t -> bool

Whether new_style overrides all attributes that old_style set.