Skip to content

Instantly share code, notes, and snippets.

@cxxxr
Last active February 14, 2017 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cxxxr/8066b4b7b250331120f9beca0069fa80 to your computer and use it in GitHub Desktop.
Save cxxxr/8066b4b7b250331120f9beca0069fa80 to your computer and use it in GitHub Desktop.
(in-package :lem-user)
(define-command list-colors-display () ()
(let* ((buffer (get-buffer-create "*colors*"))
(p (buffer-point buffer)))
(switch-to-buffer buffer)
(erase-buffer buffer)
(dolist (color (reverse lem.term::*colors*))
(let ((attribute (make-attribute (lem.term::color-name color) nil)))
(with-point ((s p))
(insert-string p (lem.term::color-name color))
(move-to-column p (+ 20 (point-charpos s)) t)
(put-text-property s p :attribute attribute)))
(insert-string p " ")
(let ((attribute (make-attribute (lem.term::color-name color) nil :reverse-p t)))
(with-point ((s p))
(insert-string p (lem.term::color-name color))
(move-to-column p (+ 20 (point-charpos s)) t)
(put-text-property s p :attribute attribute))
(insert-string p " ")
(insert-string p (format nil "#~2,'0X~2,'0X~2,'0X"
(lem.term::color-r color)
(lem.term::color-g color)
(lem.term::color-b color)))
(insert-character p #\newline)))
(buffer-start p)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment