aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEli Zaretskii2001-04-29 10:11:11 +0000
committerEli Zaretskii2001-04-29 10:11:11 +0000
commite2f599e95b135db0eb05da0de5c76586474e5d71 (patch)
tree7bae6a9a409af4a52fc1d61be917e6e43e753c8b
parent7ef5e8702dce5993150ebbbb7b81006992578c94 (diff)
downloademacs-e2f599e95b135db0eb05da0de5c76586474e5d71.tar.gz
emacs-e2f599e95b135db0eb05da0de5c76586474e5d71.zip
(tty-color-define, tty-color-off-gray-diag)
(tty-color-translate, tty-color-by-index, tty-color-values) (tty-color-desc): Doc fix.
-rw-r--r--lisp/ChangeLog6
-rw-r--r--lisp/term/tty-colors.el19
2 files changed, 21 insertions, 4 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index dd809ad19e4..12edb45ccef 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
12001-04-29 Eli Zaretskii <eliz@is.elta.co.il>
2
3 * term/tty-colors.el (tty-color-define, tty-color-off-gray-diag)
4 (tty-color-translate, tty-color-by-index, tty-color-values)
5 (tty-color-desc): Doc fix.
6
12001-04-27 Eli Zaretskii <eliz@is.elta.co.il> 72001-04-27 Eli Zaretskii <eliz@is.elta.co.il>
2 8
3 * dired-aux.el (dired-do-create-files, dired-do-copy) 9 * dired-aux.el (dired-do-create-files, dired-do-copy)
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el
index 003e4de49e0..2f479354b17 100644
--- a/lisp/term/tty-colors.el
+++ b/lisp/term/tty-colors.el
@@ -795,12 +795,13 @@ A canonicalized color name is all-lower case, with any blanks removed."
795(defun tty-color-define (name index &optional rgb frame) 795(defun tty-color-define (name index &optional rgb frame)
796 "Specify a tty color by its NAME, terminal INDEX and RGB values. 796 "Specify a tty color by its NAME, terminal INDEX and RGB values.
797NAME is a string, INDEX is typically a small integer used to send to 797NAME is a string, INDEX is typically a small integer used to send to
798the terminal driver to switch on this color, and RGB is a list of 3 798the terminal driver a command to switch this color on, and RGB is a
799numbers that specify the intensity of red, green, and blue components 799list of 3 numbers that specify the intensity of red, green, and blue
800of the color. 800components of the color.
801If specified, each one of the RGB components must be a number between 801If specified, each one of the RGB components must be a number between
8020 and 65535. If RGB is omitted, the specified color will never be used 8020 and 65535. If RGB is omitted, the specified color will never be used
803by `tty-color-translate' as an approximation to another color. 803by `tty-color-translate' as an approximation to another color.
804FRAME is the frame where the defined color should be used.
804If FRAME is not specified or is nil, it defaults to the selected frame." 805If FRAME is not specified or is nil, it defaults to the selected frame."
805 (if (or (not (stringp name)) 806 (if (or (not (stringp name))
806 (not (integerp index)) 807 (not (integerp index))
@@ -815,7 +816,11 @@ If FRAME is unspecified or nil, it defaults to the selected frame."
815 (setq tty-defined-color-alist nil)) 816 (setq tty-defined-color-alist nil))
816 817
817(defun tty-color-off-gray-diag (r g b) 818(defun tty-color-off-gray-diag (r g b)
818 "Compute the angle between the color given by R,G,B and the gray diagonal." 819 "Compute the angle between the color given by R,G,B and the gray diagonal.
820The gray diagonal is the diagonal of the 3D cube in RGB space which
821connects the points corresponding to the black and white colors. All the
822colors whose RGB coordinates belong to this diagonal are various shades
823of gray, thus the name."
819 (let ((mag (sqrt (* 3 (+ (* r r) (* g g) (* b b)))))) 824 (let ((mag (sqrt (* 3 (+ (* r r) (* g g) (* b b))))))
820 (if (< mag 1) 0 (acos (/ (+ r g b) mag))))) 825 (if (< mag 1) 0 (acos (/ (+ r g b) mag)))))
821 826
@@ -864,9 +869,11 @@ FRAME defaults to the selected frame."
864 869
865(defun tty-color-translate (color &optional frame) 870(defun tty-color-translate (color &optional frame)
866 "Given a color COLOR, return the index of the corresponding TTY color. 871 "Given a color COLOR, return the index of the corresponding TTY color.
872
867COLOR must be a string that is either the color's name, or its X-style 873COLOR must be a string that is either the color's name, or its X-style
868specification like \"#RRGGBB\" or \"RGB:rr/gg/bb\", where each primary. 874specification like \"#RRGGBB\" or \"RGB:rr/gg/bb\", where each primary.
869color can be given with 1 to 4 hex digits. 875color can be given with 1 to 4 hex digits.
876
870If COLOR is a color name that is found among supported colors in 877If COLOR is a color name that is found among supported colors in
871`tty-color-alist', the associated index is returned. Otherwise, the 878`tty-color-alist', the associated index is returned. Otherwise, the
872RGB values of the color, either as given by the argument or from 879RGB values of the color, either as given by the argument or from
@@ -875,6 +882,7 @@ supported color that is the best approximation for COLOR in the RGB
875space. 882space.
876If COLOR is neither a valid X RGB specification of the color, nor a 883If COLOR is neither a valid X RGB specification of the color, nor a
877name of a color in `color-name-rgb-alist', the returned value is nil. 884name of a color in `color-name-rgb-alist', the returned value is nil.
885
878If FRAME is unspecified or nil, it defaults to the selected frame." 886If FRAME is unspecified or nil, it defaults to the selected frame."
879 (and (stringp color) 887 (and (stringp color)
880 (let* ((color (tty-color-canonicalize color)) 888 (let* ((color (tty-color-canonicalize color))
@@ -938,6 +946,7 @@ If FRAME is unspecified or nil, it defaults to the selected frame."
938 946
939(defun tty-color-by-index (idx &optional frame) 947(defun tty-color-by-index (idx &optional frame)
940 "Given a numeric index of a tty color, return its description. 948 "Given a numeric index of a tty color, return its description.
949
941FRAME, if unspecified or nil, defaults to the selected frame. 950FRAME, if unspecified or nil, defaults to the selected frame.
942Value is a list of the form \(NAME INDEX R G B\)." 951Value is a list of the form \(NAME INDEX R G B\)."
943 (and idx 952 (and idx
@@ -952,6 +961,7 @@ Value is a list of the form \(NAME INDEX R G B\)."
952 961
953(defun tty-color-values (color &optional frame) 962(defun tty-color-values (color &optional frame)
954 "Return RGB values of the color COLOR on a termcap frame FRAME. 963 "Return RGB values of the color COLOR on a termcap frame FRAME.
964
955If COLOR is not directly supported by the display, return the RGB 965If COLOR is not directly supported by the display, return the RGB
956values for a supported color that is its best approximation. 966values for a supported color that is its best approximation.
957The value is a list of integer RGB values--\(RED GREEN BLUE\). 967The value is a list of integer RGB values--\(RED GREEN BLUE\).
@@ -971,6 +981,7 @@ If FRAME is omitted or nil, use the selected frame."
971 981
972(defun tty-color-desc (color &optional frame) 982(defun tty-color-desc (color &optional frame)
973 "Return the description of the color COLOR for a character terminal. 983 "Return the description of the color COLOR for a character terminal.
984
974FRAME, if unspecified or nil, defaults to the selected frame. 985FRAME, if unspecified or nil, defaults to the selected frame.
975Value is a list of the form \(NAME INDEX R G B\). Note that the returned 986Value is a list of the form \(NAME INDEX R G B\). Note that the returned
976NAME is not necessarily the same string as the argument COLOR, because 987NAME is not necessarily the same string as the argument COLOR, because