AtlatestRepositorysigil-ansi
sigil-ansi / treeREADME.md
1
# sigil-ansi3
ANSI terminal color and formatting library for [Sigil](https://codeberg.org/sigil/sigil).5
Provides ANSI escape codes for terminal colors and text formatting. All6
functions are prefixed with `a:` to avoid naming conflicts.8
## Usage10
```scheme11
(import (sigil ansi))13
(display (a:green "PASS"))14
(display (a:bold (a:red "FAIL")))15
(display (a:dim "at test.sgl:42"))16
```18
Styles compose by nesting:20
```scheme21
(display (a:bold (a:underline (a:cyan "Important"))))22
```24
Cursor and screen control:26
```scheme27
(display (a:clear-screen))28
(display (a:cursor-position 10 20))29
```31
Disable color globally for non-TTY output:33
```scheme34
(with-ansi-disabled35
(lambda ()36
(display (a:red "no color here"))))37
```39
## API41
| 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 & Test52
```sh53
sigil deps install54
sigil test55
```57
## License59
BSD-3-Clause. See `package.sgl` for authors.