aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2002-01-25 13:16:23 +0000
committerEli Zaretskii2002-01-25 13:16:23 +0000
commit68fe2e0f619db7a3db2449ce283cdc952cd1e597 (patch)
tree8d20a9b035dac9a0774128bd1525039ac08f5a51
parentf5e4bd09562dc9dc2b0e4a4da39303cc94fcad3f (diff)
downloademacs-68fe2e0f619db7a3db2449ce283cdc952cd1e597.tar.gz
emacs-68fe2e0f619db7a3db2449ce283cdc952cd1e597.zip
(tty-standard-colors): Reverse the order of colors.
(tty-register-default-colors): New function; code moved from startup.el's command-line.
-rw-r--r--lisp/term/tty-colors.el41
1 files changed, 32 insertions, 9 deletions
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index fc21aee2225..a0dd09db1cb 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -741,14 +741,14 @@
741 "An alist of X color names and associated 8-bit RGB values.") 741 "An alist of X color names and associated 8-bit RGB values.")
742 742
743(defvar tty-standard-colors 743(defvar tty-standard-colors
744 '(("white" 7 65535 65535 65535) 744 '(("black" 0 0 0 0)
745 ("cyan" 6 0 65535 65535)
746 ("magenta" 5 65535 0 65535)
747 ("blue" 4 0 0 65535)
748 ("yellow" 3 65535 65535 0)
749 ("green" 2 0 65535 0)
750 ("red" 1 65535 0 0) 745 ("red" 1 65535 0 0)
751 ("black" 0 0 0 0)) 746 ("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.") 752 "An alist of 8 standard tty colors, their indices and RGB values.")
753 753
754;; This is used by term.c 754;; This is used by term.c
@@ -784,17 +784,40 @@ color."
784 tty-defined-color-alist) 784 tty-defined-color-alist)
785 785
786(defun tty-modify-color-alist (elt &optional frame) 786(defun tty-modify-color-alist (elt &optional frame)
787 "Put the association ELT int the alist of terminal colors for FRAME. 787 "Put the association ELT into the alist of terminal colors for FRAME.
788ELT should be of the form \(NAME INDEX R G B\) (see `tty-color-alist' 788ELT should be of the form \(NAME INDEX R G B\) (see `tty-color-alist'
789for details). 789for details).
790If the association for NAME already exists in the color alist, it is
791modified to specify \(INDEX R G B\) as its cdr. Otherwise, ELT is
792appended to the end of the color alist.
790If FRAME is unspecified or nil, it defaults to the selected frame. 793If FRAME is unspecified or nil, it defaults to the selected frame.
791Value is the modified color alist for FRAME." 794Value is the modified color alist for FRAME."
792 (let* ((entry (assoc (car elt) (tty-color-alist frame)))) 795 (let* ((entry (assoc (car elt) (tty-color-alist frame))))
793 (if entry 796 (if entry
794 (setcdr entry (cdr elt)) 797 (setcdr entry (cdr elt))
795 (setq tty-defined-color-alist (cons elt tty-defined-color-alist))) 798 ;; 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)))
796 tty-defined-color-alist)) 804 tty-defined-color-alist))
797 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
798(defun tty-color-canonicalize (color) 821(defun tty-color-canonicalize (color)
799 "Return COLOR in canonical form. 822 "Return COLOR in canonical form.
800A canonicalized color name is all-lower case, with any blanks removed." 823A canonicalized color name is all-lower case, with any blanks removed."