changeset 23461:b84718f930f8

(msdos-color-values): New variable. (x-color-values): New function, emulates its namesake from src/xfns.c. (msdos-bg-mode): Add all dark colors to those which return "dark".
author Eli Zaretskii <eliz@gnu.org>
date Wed, 14 Oct 1998 15:11:12 +0000
parents 94f4ba741f22
children aaad8461ff34
files lisp/term/pc-win.el
diffstat 1 files changed, 43 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/term/pc-win.el	Wed Oct 14 14:36:33 1998 +0000
+++ b/lisp/term/pc-win.el	Wed Oct 14 15:11:12 1998 +0000
@@ -242,7 +242,11 @@
   (let* ((frame (or frame (selected-frame)))
 	 (params (frame-parameters frame))
 	 (bg (cdr (assq 'background-color params))))
-    (if (member bg '("black" "blue" "darkgray" "green"))
+    ;; The list of ``dark'' colors should be consistent with
+    ;; `x-color-values' (below) and the dark/light color
+    ;; decisions `frame-set-background-mode' in lisp/faces.el.
+    (if (member bg
+		'("black" "blue" "green" "red" "magenta" "brown" "darkgray"))
 	'dark
       'light)))
 
@@ -312,6 +316,44 @@
 (defun x-display-visual-class (&optional frame) 'static-color)
 (fset 'x-display-save-under 'ignore)
 (fset 'x-get-resource 'ignore)
+;;;
+;;; This is copied from etc/rgb.txt, except that some values were changed
+;;; a bit to make them consistent with DOS console colors.  The order of
+;;; the colors is according to the PC text mode color codes.
+;;;
+;;; If you want to change the RGB values, keep in mind that various pieces
+;;; of Emacs think that a color whose RGB values add up to less than 0.6 of
+;;; the values for WHITE (i.e. less than 459) are ``dark'', otherwise the
+;;; color is ``light''; see `frame-set-background-mode' in lisp/faces.el for
+;;; an example.
+(defvar msdos-color-values
+  '(("black"          0   0   0)
+    ("blue"           0   0 255)
+    ("green"          0 255   0)
+    ("cyan"           0 255 255)
+    ("red"          255   0   0)
+    ("magenta"      139   0 139)	; dark magenta
+    ("brown"        165  42  42)
+    ("lightgray"    211 211 211)
+    ("darkgray"     102 102 102)	; gray40
+    ("lightblue"    173 216 230)
+    ("lightgreen"   144 238 144)
+    ("lightcyan"    224 255 255)
+    ("lightred"     255  52 179)	; maroon1
+    ("lightmagenta" 238   0 238)	; magenta2
+    ("yellow"       255 255   0)
+    ("white"        255 255 255))
+  "A list of MS-DOS console colors and their RGB values.")
+
+(defun x-color-values (color &optional frame)
+  "Return a description of the color named COLOR on frame FRAME.\n\
+The value is a list of integer RGB values--(RED GREEN BLUE).\n\
+These values range from 0 to 255; white is (255 255 255).\n\
+If FRAME is omitted or nil, use the selected frame."
+  (if (x-color-defined-p color)
+      (let ((frame (or frame (selected-frame)))
+	    (color-code (msdos-color-translate color)))
+	(cdr (nth color-code msdos-color-values)))))
 
 ;; From lisp/term/x-win.el
 (setq x-display-name "pc")