You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
9 months ago | |
---|---|---|
README.md | 9 months ago | |
main.slo | 9 months ago | |
module.json | 9 months ago |
README.md
ansi
ansi is a collection of utility functions for creating ansi/vt100-style escape sequences.
To be able to load this module within slope via load-mod
clone this folder into your main modules folder (see slope -modpath
).
api
Every proc in the module evaluates to a string (ie. it does not display/write the value).
(ansi-curs-home)
(ansi-curs-pos [row: number] [col: number])
(ansi-curs-up [row-count: number])
(ansi-curs-down [row-count: number])
(ansi-curs-forward [col-count: number])
(ansi-curs-back [col-count: number])
(ansi-save-pos)
(ansi-restore-pos)
(ansi-erase-line)
(ansi-erase->line-end)
(ansi-erase->line-start)
(ansi-erase->top)
(ansi-erase->bottom)
(ansi-erase-screen)
(ansi-att-reset)
(ansi-att-bold)
(ansi-att-dim)
(ansi-att-italic)
(ansi-att-underline)
(ansi-att-slow-blink)
(ansi-att-fast-blink)
(ansi-att-inverse)
(ansi-att-bold-off)
(ansi-att-normal-intensity)
(ansi-att-italic-off)
(ansi-att-underline-off)
(ansi-att-blink-off)
(ansi-att-inverse-off)
(ansi-color [fg: number|list] [bg: number|list])
ansi-color
has some premade lists available that form color pairs for easy passing by name:black
red
green
yellow
blue
magenta
cyan
white
bright-black
bright-red
bright-green
bright-yellow
bright-blue
bright-magenta
bright-cyan
bright-white
(ansi-256-color-fg [number])
(ansi-256-color-bg [number])
(ansi-true-color-fg [r: number] [g: number] [b: number])
(ansi-true-color-bg [r: number] [g: number] [b: number])
Example
(load-mod "ansi")
(define writer (string-make-buf))
(write (ansi-true-color-fg 200 50 50) writer)
(write (ansi-true-color-bg 255 255 255) writer)
(write "Hello, color!" writer)
(write (ansi-att-reset) writer)
(display (read-all writer) "\n")
The above should output something red text on a white background.