在Common Lisp REPL中更改文本的颜色

S4M*_*S4M 4 emacs colors common-lisp

我想控制Common Lisp中显示的文本的颜色。像这样的伪代码:

(print-color (:red "hello") (:blue "world"))
Run Code Online (Sandbox Code Playgroud)

有什么办法可以做到吗?我使用SBCL,我的代表在emacs中。谢谢!

Sal*_*Egg 6

您可以使用ANSI转义码来打印彩色文本:

(format t "~c[31mabc~c[0m~%" #\ESC #\ESC) ; this prints a red "abc" for most modern terminals
Run Code Online (Sandbox Code Playgroud)

我不确定这是否适用于粘液。