diff options
| author | Eli Zaretskii | 2001-04-29 10:11:11 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2001-04-29 10:11:11 +0000 |
| commit | e2f599e95b135db0eb05da0de5c76586474e5d71 (patch) | |
| tree | 7bae6a9a409af4a52fc1d61be917e6e43e753c8b | |
| parent | 7ef5e8702dce5993150ebbbb7b81006992578c94 (diff) | |
| download | emacs-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/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/term/tty-colors.el | 19 |
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 @@ | |||
| 1 | 2001-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 | |||
| 1 | 2001-04-27 Eli Zaretskii <eliz@is.elta.co.il> | 7 | 2001-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. |
| 797 | NAME is a string, INDEX is typically a small integer used to send to | 797 | NAME is a string, INDEX is typically a small integer used to send to |
| 798 | the terminal driver to switch on this color, and RGB is a list of 3 | 798 | the terminal driver a command to switch this color on, and RGB is a |
| 799 | numbers that specify the intensity of red, green, and blue components | 799 | list of 3 numbers that specify the intensity of red, green, and blue |
| 800 | of the color. | 800 | components of the color. |
| 801 | If specified, each one of the RGB components must be a number between | 801 | If specified, each one of the RGB components must be a number between |
| 802 | 0 and 65535. If RGB is omitted, the specified color will never be used | 802 | 0 and 65535. If RGB is omitted, the specified color will never be used |
| 803 | by `tty-color-translate' as an approximation to another color. | 803 | by `tty-color-translate' as an approximation to another color. |
| 804 | FRAME is the frame where the defined color should be used. | ||
| 804 | If FRAME is not specified or is nil, it defaults to the selected frame." | 805 | If 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. |
| 820 | The gray diagonal is the diagonal of the 3D cube in RGB space which | ||
| 821 | connects the points corresponding to the black and white colors. All the | ||
| 822 | colors whose RGB coordinates belong to this diagonal are various shades | ||
| 823 | of 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 | |||
| 867 | COLOR must be a string that is either the color's name, or its X-style | 873 | COLOR must be a string that is either the color's name, or its X-style |
| 868 | specification like \"#RRGGBB\" or \"RGB:rr/gg/bb\", where each primary. | 874 | specification like \"#RRGGBB\" or \"RGB:rr/gg/bb\", where each primary. |
| 869 | color can be given with 1 to 4 hex digits. | 875 | color can be given with 1 to 4 hex digits. |
| 876 | |||
| 870 | If COLOR is a color name that is found among supported colors in | 877 | If 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 |
| 872 | RGB values of the color, either as given by the argument or from | 879 | RGB 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 | |||
| 875 | space. | 882 | space. |
| 876 | If COLOR is neither a valid X RGB specification of the color, nor a | 883 | If COLOR is neither a valid X RGB specification of the color, nor a |
| 877 | name of a color in `color-name-rgb-alist', the returned value is nil. | 884 | name of a color in `color-name-rgb-alist', the returned value is nil. |
| 885 | |||
| 878 | If FRAME is unspecified or nil, it defaults to the selected frame." | 886 | If 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 | |||
| 941 | FRAME, if unspecified or nil, defaults to the selected frame. | 950 | FRAME, if unspecified or nil, defaults to the selected frame. |
| 942 | Value is a list of the form \(NAME INDEX R G B\)." | 951 | Value 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 | |||
| 955 | If COLOR is not directly supported by the display, return the RGB | 965 | If COLOR is not directly supported by the display, return the RGB |
| 956 | values for a supported color that is its best approximation. | 966 | values for a supported color that is its best approximation. |
| 957 | The value is a list of integer RGB values--\(RED GREEN BLUE\). | 967 | The 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 | |||
| 974 | FRAME, if unspecified or nil, defaults to the selected frame. | 985 | FRAME, if unspecified or nil, defaults to the selected frame. |
| 975 | Value is a list of the form \(NAME INDEX R G B\). Note that the returned | 986 | Value is a list of the form \(NAME INDEX R G B\). Note that the returned |
| 976 | NAME is not necessarily the same string as the argument COLOR, because | 987 | NAME is not necessarily the same string as the argument COLOR, because |