print-with-colors   macro


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/runtime/scheme.xtm

Implementation

(define-macro (print-with-colors fg bg bold . body)
  `(let ((colors '((black . 0)
       (red . 1)
       (green . 2)
       (yellow . 3)
       (blue . 4)
       (magenta . 5)
       (cyan . 6)
       (white . 7)
       (default . 9)
       (none . 9))))
     (ascii-print-color (if ,bold 1 0)
      (cdr (assoc ,fg colors))
      (cdr (assoc ,bg colors)))
     ,@body
     ;; return colors to normal
     (ascii-print-color 0 7 9)))


Back to Index