Function: w32-tty-define-8bit-colors

w32-tty-define-8bit-colors is a byte-compiled function defined in w32console.el.gz.

Signature

(w32-tty-define-8bit-colors)

Documentation

Defines 8-bit color space for w32 tty display.

Source Code

;; Defined in /usr/src/emacs/lisp/term/w32console.el.gz
(defun w32-tty-define-8bit-colors ()
  "Defines 8-bit color space for w32 tty display."
  (let ((r 0) (b 0) (g 0)
        (n (- 256 (w32-tty-define-base-colors)))
        (convert-to-16bit (lambda (prim) (logior prim (ash prim 8)))))
    (while (> n 24) ; non-grey
      (let ((i (- 256 n))
            (c (mapcar convert-to-16bit
                       (mapcar (lambda (x) (if (zerop x) 0 (+ (* x 40) 55)))
                               (list r g b)))))
        (tty-color-define (format "color-%d" i) i c))
      (setq b (1+ b))
      (when (> b 5) (setq g (1+ g) b 0))
      (when (> g 5) (setq r (1+ r) g 0))
      (setq n (1- n)))
    (while (> n 0) ; all-grey
      (let* ((i (- 256 n))
             (v (funcall convert-to-16bit (+ 8 (* (- 24 n) 10))))
             (c (list v v v)))
        (tty-color-define (format "color-%d" i) i c))
      (setq n (1- n)))))