AtlatestRepositorysigil-ansi
1# sigil-ansi
2
3ANSI terminal color and formatting library for [Sigil](https://codeberg.org/sigil/sigil).
4
5Provides ANSI escape codes for terminal colors and text formatting. All
6functions are prefixed with `a:` to avoid naming conflicts.
7
8## Usage
9
10```scheme
11(import (sigil ansi))
13(display (a:green "PASS"))
14(display (a:bold (a:red "FAIL")))
15(display (a:dim "at test.sgl:42"))
16```
18Styles compose by nesting:
20```scheme
21(display (a:bold (a:underline (a:cyan "Important"))))
22```
24Cursor and screen control:
26```scheme
27(display (a:clear-screen))
28(display (a:cursor-position 10 20))
29```
31Disable color globally for non-TTY output:
33```scheme
34(with-ansi-disabled
35 (lambda ()
36 (display (a:red "no color here"))))
37```
39## API
41| Surface | Functions |
42|---------|-----------|
43| Foreground colors | `a:black` `a:red` `a:green` `a:yellow` `a:blue` `a:magenta` `a:cyan` `a:white` (+ `a:bright-*` variants) |
44| Background colors | `a:bg-black` `a:bg-red` `a:bg-green` `a:bg-yellow` `a:bg-blue` `a:bg-magenta` `a:bg-cyan` `a:bg-white` |
45| Styles | `a:bold` `a:dim` `a:italic` `a:underline` `a:blink` `a:inverse` `a:hidden` `a:strikethrough` |
46| Reset | `a:reset` |
47| Cursor | `a:clear-screen` `a:clear-line` `a:cursor-up` `a:cursor-down` `a:cursor-forward` `a:cursor-back` `a:cursor-home` `a:cursor-position` `a:hide-cursor` `a:show-cursor` `a:save-cursor` `a:restore-cursor` |
48| Utilities | `strip-ansi` `ansi-enabled?` `with-ansi-disabled` |
50## Build & Test
52```sh
53sigil deps install
54sigil test
55```
57## License
59BSD-3-Clause. See `package.sgl` for authors.