package wax-lib
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=41b580846af8d41bdf6c3f005f62e38feda3e60fe2e9e4aa440db34ce515a153
sha512=4b3a181fcc7d743194a8647260870fb5190770066a197bcc48104c2b77fd40c643228b795c2bcd6b29a120820e969eb42a37a9bcec98b3f608d13f152d9f6579
doc/wax-lib.utils/Wax_utils/Colors/index.html
Module Wax_utils.ColorsSource
Determines whether color output should be used.
should_use_color ~color ~out_channel checks if ANSI color codes should be emitted based on the color flag and the out_channel. If Auto, it checks for `NO_COLOR` environment variable, `TERM` environment variable, and if out_channel is a TTY.
update_flag ~color ~out_channel checks if ANSI color codes should be emitted based on the color flag and stdout. If Auto, it checks for `NO_COLOR` environment variable, `TERM` environment variable, and if stdout is a TTY.
type style = | Keyword(*For language keywords (e.g., `func`, `let`, `if` in Wax; `module`, `func`, `(type ...)` in Wasm).
*)| Instruction(*For Wasm instructions (e.g., `i32.add`, `call $func`).
*)| Attribute(*For attributes (e.g., `offset=4`, `align=2` in Wasm; Rust-like attributes like `#
*)derive(...)`).| Type(*For type names (e.g., `i32`, `f64`, `funcref`).
*)| Identifier(*For variable, function, or type identifiers.
*)| Constant(*For numeric or boolean literals (e.g., `123`, `0.5`, `true`).
*)| String(*For string literals.
*)| Operator(*For operators (e.g., `+`, `-`, `=`, `!`).
*)| Annotation(*For annotations (e.g., `(@custom)` in Wasm; Rust macros like `vec!`).
*)| Comment(*For comments in the code.
*)| Punctuation(*For structural punctuation (e.g., (, ), :, ;, ,).
*)
style represents a semantic category for syntax highlighting.
type theme = {keyword : string;instruction : string;attribute : string;type_ : string;identifier : string;constant : string;string : string;operator : string;annotation : string;comment : string;punctuation : string;reset : string;
}theme defines the ANSI escape codes for each syntax style.
escape_sequence theme style returns the ANSI escape code for the given style from the provided theme.
The Wax source palette: used by Wax_lang.Output to render Wax source, and by diagnostics to colour a Wax AST fragment embedded in a message.
The WebAssembly-text source palette: used by Wax_wasm.Output to render WAT source, and by diagnostics to colour a WAT AST fragment embedded in a message (e.g. types in red rather than the Wax cyan).