Skip to content

Instantly share code, notes, and snippets.

@fouric
Last active August 29, 2019 02:08
Show Gist options
  • Save fouric/83165382d148c31df0c4779513054c57 to your computer and use it in GitHub Desktop.
Save fouric/83165382d148c31df0c4779513054c57 to your computer and use it in GitHub Desktop.
(defun foo (color baz zuul)
(typecase color
(truecolor (let ((r (aref color 0))
(g (aref color 1))
(b (aref color 2)))
(list baz 2 r g b)))
(ansi-color (+ zuul (ansi-color-code color)))
(otherwise (error "~S is not a color" color))))
;; then just
(defun fg (color)
(foo 38 30))
(defun bg (color)
(foo 48 40))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment