AtlatestRepositorysigil-ansi
1# sigil-ansi
2
3> **Archived at Sigil 0.19.0:** The maintained implementation now lives in
4> `codeberg:sigil/sigil`. This repository and all tags remain available for
5> provenance, but no further standalone releases will be published.
6
7ANSI terminal color and formatting library for [Sigil](https://codeberg.org/sigil/sigil).
8
9Provides ANSI escape codes for terminal colors and text formatting. All
10functions are prefixed with `a:` to avoid naming conflicts.
12## Usage
14```scheme
15(import (sigil ansi))
17(display (a:green "PASS"))
18(display (a:bold (a:red "FAIL")))
19(display (a:dim "at test.sgl:42"))
20```
22Styles compose by nesting:
24```scheme
25(display (a:bold (a:underline (a:cyan "Important"))))
26```
28Cursor and screen control:
30```scheme
31(display (a:clear-screen))
32(display (a:cursor-position 10 20))
33```
35Disable color globally for non-TTY output:
37```scheme
38(with-ansi-disabled
39 (lambda ()
40 (display (a:red "no color here"))))
41```
43## API
45| Surface | Functions |
46|---------|-----------|
47| Foreground colors | `a:black` `a:red` `a:green` `a:yellow` `a:blue` `a:magenta` `a:cyan` `a:white` (+ `a:bright-*` variants) |
48| 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` |
49| Styles | `a:bold` `a:dim` `a:italic` `a:underline` `a:blink` `a:inverse` `a:hidden` `a:strikethrough` |
50| Reset | `a:reset` |
51| 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` |
52| Utilities | `strip-ansi` `ansi-enabled?` `with-ansi-disabled` |
54## Build & Test
56```sh
57sigil deps install
58sigil test
59```
61## License
63BSD-3-Clause. See `package.sgl` for authors.