AtlatestRepositorysigil-ansi
sigil-ansi / treeREADME.md
1
# sigil-ansi3
> **Archived at Sigil 0.19.0:** The maintained implementation now lives in4
> `codeberg:sigil/sigil`. This repository and all tags remain available for5
> provenance, but no further standalone releases will be published.7
ANSI terminal color and formatting library for [Sigil](https://codeberg.org/sigil/sigil).9
Provides ANSI escape codes for terminal colors and text formatting. All10
functions are prefixed with `a:` to avoid naming conflicts.12
## Usage14
```scheme15
(import (sigil ansi))17
(display (a:green "PASS"))18
(display (a:bold (a:red "FAIL")))19
(display (a:dim "at test.sgl:42"))20
```22
Styles compose by nesting:24
```scheme25
(display (a:bold (a:underline (a:cyan "Important"))))26
```28
Cursor and screen control:30
```scheme31
(display (a:clear-screen))32
(display (a:cursor-position 10 20))33
```35
Disable color globally for non-TTY output:37
```scheme38
(with-ansi-disabled39
(lambda ()40
(display (a:red "no color here"))))41
```43
## API45
| 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 & Test56
```sh57
sigil deps install58
sigil test59
```61
## License63
BSD-3-Clause. See `package.sgl` for authors.