AtlatestRenderedmarkdown
Readme

sigil-ansi

Archived at Sigil 0.19.0: The maintained implementation now lives in codeberg:sigil/sigil. This repository and all tags remain available for provenance, but no further standalone releases will be published.

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

SurfaceFunctions
Foreground colorsa:black a:red a:green a:yellow a:blue a:magenta a:cyan a:white (+ a:bright-* variants)
Background colorsa:bg-black a:bg-red a:bg-green a:bg-yellow a:bg-blue a:bg-magenta a:bg-cyan a:bg-white
Stylesa:bold a:dim a:italic a:underline a:blink a:inverse a:hidden a:strikethrough
Reseta:reset
Cursora: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
Utilitiesstrip-ansi ansi-enabled? with-ansi-disabled

Build & Test

sigil deps install
sigil test

License

BSD-3-Clause. See package.sgl for authors.