741 |
"An alist of X color names and associated 8-bit RGB values.") |
"An alist of X color names and associated 8-bit RGB values.") |
742 |
|
|
743 |
(defvar tty-standard-colors |
(defvar tty-standard-colors |
744 |
'(("white" 7 65535 65535 65535) |
'(("black" 0 0 0 0) |
|
("cyan" 6 0 65535 65535) |
|
|
("magenta" 5 65535 0 65535) |
|
|
("blue" 4 0 0 65535) |
|
|
("yellow" 3 65535 65535 0) |
|
|
("green" 2 0 65535 0) |
|
745 |
("red" 1 65535 0 0) |
("red" 1 65535 0 0) |
746 |
("black" 0 0 0 0)) |
("green" 2 0 65535 0) |
747 |
|
("yellow" 3 65535 65535 0) |
748 |
|
("blue" 4 0 0 65535) |
749 |
|
("magenta" 5 65535 0 65535) |
750 |
|
("cyan" 6 0 65535 65535) |
751 |
|
("white" 7 65535 65535 65535)) |
752 |
"An alist of 8 standard tty colors, their indices and RGB values.") |
"An alist of 8 standard tty colors, their indices and RGB values.") |
753 |
|
|
754 |
;; This is used by term.c |
;; This is used by term.c |
784 |
tty-defined-color-alist) |
tty-defined-color-alist) |
785 |
|
|
786 |
(defun tty-modify-color-alist (elt &optional frame) |
(defun tty-modify-color-alist (elt &optional frame) |
787 |
"Put the association ELT int the alist of terminal colors for FRAME. |
"Put the association ELT into the alist of terminal colors for FRAME. |
788 |
ELT should be of the form \(NAME INDEX R G B\) (see `tty-color-alist' |
ELT should be of the form \(NAME INDEX R G B\) (see `tty-color-alist' |
789 |
for details). |
for details). |
790 |
|
If the association for NAME already exists in the color alist, it is |
791 |
|
modified to specify \(INDEX R G B\) as its cdr. Otherwise, ELT is |
792 |
|
appended to the end of the color alist. |
793 |
If FRAME is unspecified or nil, it defaults to the selected frame. |
If FRAME is unspecified or nil, it defaults to the selected frame. |
794 |
Value is the modified color alist for FRAME." |
Value is the modified color alist for FRAME." |
795 |
(let* ((entry (assoc (car elt) (tty-color-alist frame)))) |
(let* ((entry (assoc (car elt) (tty-color-alist frame)))) |
796 |
(if entry |
(if entry |
797 |
(setcdr entry (cdr elt)) |
(setcdr entry (cdr elt)) |
798 |
(setq tty-defined-color-alist (cons elt tty-defined-color-alist))) |
;; Keep the colors in the order they are registered. |
799 |
|
(setq entry |
800 |
|
(list (append (list (car elt) |
801 |
|
(cadr elt)) |
802 |
|
(copy-sequence (cddr elt))))) |
803 |
|
(setq tty-defined-color-alist (nconc tty-defined-color-alist entry))) |
804 |
tty-defined-color-alist)) |
tty-defined-color-alist)) |
805 |
|
|
806 |
|
(defun tty-register-default-colors () |
807 |
|
"Register the default set of colors for a character terminal." |
808 |
|
(let* ((colors (cond ((eq window-system 'pc) |
809 |
|
msdos-color-values) |
810 |
|
((eq system-type 'windows-nt) |
811 |
|
w32-tty-standard-colors) |
812 |
|
(t tty-standard-colors))) |
813 |
|
(color (car colors))) |
814 |
|
(while colors |
815 |
|
(tty-color-define (car color) (cadr color) (cddr color)) |
816 |
|
(setq colors (cdr colors) color (car colors))) |
817 |
|
;; Modifying color mappings means realized faces don't |
818 |
|
;; use the right colors, so clear them. |
819 |
|
(clear-face-cache))) |
820 |
|
|
821 |
(defun tty-color-canonicalize (color) |
(defun tty-color-canonicalize (color) |
822 |
"Return COLOR in canonical form. |
"Return COLOR in canonical form. |
823 |
A canonicalized color name is all-lower case, with any blanks removed." |
A canonicalized color name is all-lower case, with any blanks removed." |