AtlatestRenderedmarkdown
sigil-ansi / treeREADME.md
Readme
sigil-ansi
ANSI terminal color and formatting library for Sigil.
Provides ANSI escape codes for terminal colors and text formatting. All functions are prefixed with a: to avoid naming conflicts.
Usage
(import (sigil ansi))
(display (a:green "PASS"))
(display (a:bold (a:red "FAIL")))
(display (a:dim "at test.sgl:42"))Styles compose by nesting:
(display (a:bold (a:underline (a:cyan "Important"))))Cursor and screen control:
(display (a:clear-screen))
(display (a:cursor-position 10 20))Disable color globally for non-TTY output:
(with-ansi-disabled
(lambda ()
(display (a:red "no color here"))))API
| Surface | Functions |
|---|---|
| Foreground colors | a:black a:red a:green a:yellow a:blue a:magenta a:cyan a:white (+ a:bright-* variants) |
| 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 |
| Styles | a:bold a:dim a:italic a:underline a:blink a:inverse a:hidden a:strikethrough |
| Reset | a:reset |
| 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 |
| Utilities | strip-ansi ansi-enabled? with-ansi-disabled |
Build & Test
sigil deps install
sigil testLicense
BSD-3-Clause. See package.sgl for authors.