diff options
| author | Eli Zaretskii | 2000-10-19 07:18:06 +0000 |
|---|---|---|
| committer | Eli Zaretskii | 2000-10-19 07:18:06 +0000 |
| commit | c8ad9e9564eb8f322eeaadb1a0e3c2a1ac5b3456 (patch) | |
| tree | 65d3ebf6a6d932641236bbe0be5a71aab52f99ce | |
| parent | 1238572245bfc04e4f436ed572d668b5c84014d1 (diff) | |
| download | emacs-c8ad9e9564eb8f322eeaadb1a0e3c2a1ac5b3456.tar.gz emacs-c8ad9e9564eb8f322eeaadb1a0e3c2a1ac5b3456.zip | |
(color-name-rgb-alist): Add a comment explaining why some "light*"
colors are deliberately absent from the alist.
| -rw-r--r-- | lisp/term/tty-colors.el | 55 |
1 files changed, 38 insertions, 17 deletions
diff --git a/lisp/term/tty-colors.el b/lisp/term/tty-colors.el index 1fe98192540..003e4de49e0 100644 --- a/lisp/term/tty-colors.el +++ b/lisp/term/tty-colors.el | |||
| @@ -36,29 +36,50 @@ | |||
| 36 | ;; rest of Emacs from including special code for this case. | 36 | ;; rest of Emacs from including special code for this case. |
| 37 | 37 | ||
| 38 | ;; Here's how it works. The support for terminal and MSDOS frames | 38 | ;; Here's how it works. The support for terminal and MSDOS frames |
| 39 | ;; maintains an alist, called `tty-color-alist', which associates | 39 | ;; maintains an alist, called `tty-defined-color-alist', which |
| 40 | ;; colors supported by the terminal driver with small integers. | 40 | ;; associates colors supported by the terminal driver with small |
| 41 | ;; (These small integers are passed to the library functions which set | 41 | ;; integers. (These small integers are passed to the library |
| 42 | ;; the color, and are effectively indices of the colors in the | 42 | ;; functions which set the color, and are effectively indices of the |
| 43 | ;; supported color palette.) When Emacs needs to send a color command | 43 | ;; colors in the supported color palette.) When Emacs needs to send a |
| 44 | ;; to the terminal, the color name is first looked up in | 44 | ;; color command to the terminal, the color name is first looked up in |
| 45 | ;; `tty-color-alist'. If not found, functions from this file can be | 45 | ;; `tty-defined-color-alist'. If not found, functions from this file |
| 46 | ;; used to map the color to one of the supported colors. | 46 | ;; can be used to map the color to one of the supported colors. |
| 47 | ;; Specifically, the X RGB values of the requested color are extracted | 47 | ;; Specifically, the X RGB values of the requested color are extracted |
| 48 | ;; from `color-name-rgb-alist' and then the supported color is found | 48 | ;; from `color-name-rgb-alist' and then the supported color is found |
| 49 | ;; with the minimal distance in the RGB space from the requested | 49 | ;; with the minimal distance in the RGB space from the requested |
| 50 | ;; color. | 50 | ;; color. |
| 51 | 51 | ||
| 52 | ;; `tty-color-alist' is created at startup by calling the function | 52 | ;; `tty-defined-color-alist' is created at startup by calling the |
| 53 | ;; `tty-color-define', defined below, passing it each supported color, | 53 | ;; function `tty-color-define', defined below, passing it each |
| 54 | ;; its index, and its RGB values. The standard list of colors | 54 | ;; supported color, its index, and its RGB values. The standard list |
| 55 | ;; supported by many Unix color terminals, including xterm, FreeBSD, | 55 | ;; of colors supported by many Unix color terminals, including xterm, |
| 56 | ;; and GNU/Linux, is supplied below in `tty-standard-colors'. If your | 56 | ;; FreeBSD, and GNU/Linux, is supplied below in `tty-standard-colors'. |
| 57 | ;; terminal supports different or additional colors, call | 57 | ;; If your terminal supports different or additional colors, call |
| 58 | ;; `tty-color-define' from your `.emacs' or `site-start.el'. | 58 | ;; `tty-color-define' from your `.emacs' or `site-start.el'. For |
| 59 | ;; more-or-less standard definitions of VGA text-mode colors, see the | ||
| 60 | ;; beginning of lisp/term/pc-win.el. | ||
| 59 | 61 | ||
| 60 | ;;; Code: | 62 | ;;; Code: |
| 61 | 63 | ||
| 64 | ;; The following list is taken from rgb.txt distributed with X. | ||
| 65 | ;; | ||
| 66 | ;; WARNING: Some colors, such as "lightred", do not appear in this | ||
| 67 | ;; list. If you think it's a good idea to add them, don't! The | ||
| 68 | ;; problem is that the X-standard definition of "red" actually | ||
| 69 | ;; corresponds to "lightred" on VGA (that's why pc-win.el and | ||
| 70 | ;; w32-fns.el define "lightred" with the same RGB values as "red" | ||
| 71 | ;; below). Adding "lightred" here would therefore create confusing | ||
| 72 | ;; and counter-intuitive results, like "red" and "lightred" being the | ||
| 73 | ;; same color. A similar situation exists with other "light*" colors. | ||
| 74 | ;; | ||
| 75 | ;; Nevertheless, "lightred" and other similar color names *are* | ||
| 76 | ;; defined for the MS-DOS and MS-Windows consoles, because the users | ||
| 77 | ;; on those systems expect these colors to be available. | ||
| 78 | ;; | ||
| 79 | ;; For these reasons, package maintaners are advised NOT to use color | ||
| 80 | ;; names such as "lightred" or "lightblue", because they will have | ||
| 81 | ;; different effect on different displays. Instead, use "red1" and | ||
| 82 | ;; "blue1", respectively. | ||
| 62 | (defvar color-name-rgb-alist | 83 | (defvar color-name-rgb-alist |
| 63 | '(("snow" 255 250 250) | 84 | '(("snow" 255 250 250) |
| 64 | ("ghostwhite" 248 248 255) | 85 | ("ghostwhite" 248 248 255) |
| @@ -713,9 +734,9 @@ | |||
| 713 | ("darkgrey" 169 169 169) | 734 | ("darkgrey" 169 169 169) |
| 714 | ("darkgray" 169 169 169) | 735 | ("darkgray" 169 169 169) |
| 715 | ("darkblue" 0 0 139) | 736 | ("darkblue" 0 0 139) |
| 716 | ("darkcyan" 0 139 139) | 737 | ("darkcyan" 0 139 139) ; no "lightmagenta", see the comment above |
| 717 | ("darkmagenta" 139 0 139) | 738 | ("darkmagenta" 139 0 139) |
| 718 | ("darkred" 139 0 0) | 739 | ("darkred" 139 0 0) ; but no "lightred", see the comment above |
| 719 | ("lightgreen" 144 238 144)) | 740 | ("lightgreen" 144 238 144)) |
| 720 | "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.") |
| 721 | 742 | ||