| Paste number 80512: | Colors for toro` |
| Pasted by: | hefner |
| When: | 1 year, 3 months ago |
| Share: | Tweet this! | http://paste.lisp.org/+1Q4G |
| Channel: | #lisp |
| Paste contents: |
;;;; sbcl --noinform --load ex-colors.lisp --no-userinit
(defun idx666 (red green blue) (+ 16 (* red 36) (* green 6) blue))
(defun setpal-code (red green blue)
(format nil "~C]4;~D;rgb:~2,'0,,X/~2,'0,,X/~2,'0,,X~D\\"
#\Esc
(idx666 red green blue)
(if (zerop red) 0 (+ 55 (* red 40)))
(if (zerop green) 0 (+ 55 (* green 40)))
(if (zerop blue) 0 (+ 55 (* blue 40)))
#\Esc))
(defun build-palette ()
(dotimes (red 6)
(dotimes (green 6)
(dotimes (blue 6)
(write-string (setpal-code red green blue) *standard-output*)))))
(build-palette)
(format t "System colors:~%")
(dotimes (color 8) (format t "~C[48;5;~Dm " #\Esc color))
(format t "~C[0m~%" #\Esc)
(dotimes (color 8) (format t "~C[48;5;~Dm " #\Esc (+ 8 color)))
(format t "~C[0m~%~%" #\Esc)
(format t "Color cube, 6x6x6:~%")
(dotimes (green 6)
(dotimes (red 6)
(dotimes (blue 6)
(format t "~C[48;5;~Dm " #\Esc (idx666 red green blue)))
(format t "~C[0m " #\Esc))
(terpri))
(format t "Grayscale ramp:~%")
(loop for color from 232 below 256
do (format t "~C[48;5;~Dm " #\Esc color))
(format t "~C[0m~%~%" #\Esc)
This paste has no annotations.