[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

gEDA-cvs: gaf.git: branch: master updated (1.5.1-20081221-10-g04e17b3)



The branch, master has been updated
       via  04e17b33aea43f01079d2a0fd1ac9457062aa392 (commit)
       via  01bd6420ecad411d804f4a1a3d41af67d901ce6a (commit)
       via  619aea627a81a5621036b0a2949e774bb5cb2e6e (commit)
       via  12d9e2127329a880ed8532808635d3ffdbf46caa (commit)
       via  9f5e54f022b73adb429633461ca88c81c394fd16 (commit)
       via  a8b55895fd6833fa36ef92c6bc7c82490ea3a294 (commit)
       via  06449db86b91db91bf5d4551acc2794cf34c97f1 (commit)
       via  af4756b843d6da32b8355a50bf3bb1f2bee0a539 (commit)
       via  05c77c57cc78b0963e52a91e6f56e8005089690a (commit)
       via  e2d6f2bfb1c24d5dfaf193dfae4aaa7cf4d0f236 (commit)
      from  3c49636e1a9e9e703fab4c6aafc69affb4fd2bab (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


=========
 Summary
=========

 gschem/include/prototype.h         |   26 +---
 gschem/lib/Makefile.am             |    4 +-
 gschem/lib/gschem-colormap-darkbg  |   65 ++++++++
 gschem/lib/gschem-colormap-lightbg |   65 ++++++++
 gschem/lib/gschem-darkbg           |  219 --------------------------
 gschem/lib/gschem-lightbg          |  225 ---------------------------
 gschem/lib/system-gschemrc.in      |    9 +-
 gschem/src/g_hook.c                |    2 +-
 gschem/src/g_rc.c                  |  179 ++++------------------
 gschem/src/g_register.c            |   26 +---
 gschem/src/gschem.c                |    6 +-
 gschem/src/o_complex.c             |    4 +-
 gschem/src/o_misc.c                |    2 +-
 gschem/src/o_net.c                 |    2 +-
 gschem/src/x_color.c               |  175 ++++++++++------------
 gschem/src/x_dialog.c              |    6 +-
 gschem/src/x_image.c               |    8 +-
 libgeda/include/colors.h           |   12 +--
 libgeda/include/globals.h          |   29 ----
 libgeda/include/prototype.h        |    8 +-
 libgeda/include/prototype_priv.h   |    3 +-
 libgeda/include/struct.h           |    8 +-
 libgeda/lib/Makefile.am            |    2 +-
 libgeda/lib/print-colormap-darkbg  |   40 +++++
 libgeda/lib/print-colormap-lightbg |   41 +++++
 libgeda/lib/system-gafrc           |   30 +++-
 libgeda/po/POTFILES.in             |    1 +
 libgeda/scheme/Makefile.am         |    2 +-
 libgeda/scheme/color-map.scm       |   74 +++++++++
 libgeda/src/f_print.c              |    6 +-
 libgeda/src/g_rc.c                 |   15 ++
 libgeda/src/g_register.c           |    1 +
 libgeda/src/o_arc_basic.c          |    4 +-
 libgeda/src/o_box_basic.c          |    4 +-
 libgeda/src/o_bus_basic.c          |    4 +-
 libgeda/src/o_circle_basic.c       |    4 +-
 libgeda/src/o_complex_basic.c      |    4 +-
 libgeda/src/o_line_basic.c         |    4 +-
 libgeda/src/o_net_basic.c          |    4 +-
 libgeda/src/o_path_basic.c         |    4 +-
 libgeda/src/o_pin_basic.c          |    4 +-
 libgeda/src/o_text_basic.c         |    4 +-
 libgeda/src/s_basic.c              |    2 +-
 libgeda/src/s_color.c              |  297 +++++++++++++++++++++++++++++-------
 44 files changed, 745 insertions(+), 889 deletions(-)
 create mode 100644 gschem/lib/gschem-colormap-darkbg
 create mode 100644 gschem/lib/gschem-colormap-lightbg
 delete mode 100644 gschem/lib/gschem-darkbg
 delete mode 100644 gschem/lib/gschem-lightbg
 create mode 100644 libgeda/lib/print-colormap-darkbg
 create mode 100644 libgeda/lib/print-colormap-lightbg
 create mode 100644 libgeda/scheme/color-map.scm


=================
 Commit Messages
=================

commit 04e17b33aea43f01079d2a0fd1ac9457062aa392
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:43:55 2008 +0000

    libgeda: Load confd files as last action in system-gafrc.
    
    Without loading the configuration files from the confd last in the
    system-gafrc, it is impossible to override e.g. attribute promotion
    settings from confd scripts.

:100644 100644 7b1663b... 2789c00... M	libgeda/lib/system-gafrc

commit 01bd6420ecad411d804f4a1a3d41af67d901ce6a
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:43:17 2008 +0000

    Use light background color maps as the default.
    
    The comments in the rc files have stated for a while that a light
    background is the default. Furthermore, all the cool CAD software uses
    light backgrounds these days.

:100644 100644 e1a86cf... cc2142b... M	gschem/lib/system-gschemrc.in
:100644 100644 f5d6713... 7b1663b... M	libgeda/lib/system-gafrc

commit 619aea627a81a5621036b0a2949e774bb5cb2e6e
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:42:46 2008 +0000

    Separate display and print color map config files.
    
    We should be able to print in color using libgeda without needing
    gschem.

:100644 100644 16eac04... d2cf22e... M	gschem/lib/Makefile.am
:000000 100644 0000000... b2a2eff... A	gschem/lib/gschem-colormap-darkbg
:000000 100644 0000000... aa658c4... A	gschem/lib/gschem-colormap-lightbg
:100644 000000 5496c16... 0000000... D	gschem/lib/gschem-darkbg
:100644 000000 dd42dbf... 0000000... D	gschem/lib/gschem-lightbg
:100644 100644 07a7958... e1a86cf... M	gschem/lib/system-gschemrc.in
:100644 100644 8a91114... 5a40a8e... M	libgeda/lib/Makefile.am
:000000 100644 0000000... 50f2a66... A	libgeda/lib/print-colormap-darkbg
:000000 100644 0000000... f709816... A	libgeda/lib/print-colormap-lightbg
:100644 100644 91d124a... f5d6713... M	libgeda/lib/system-gafrc

commit 12d9e2127329a880ed8532808635d3ffdbf46caa
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:29:51 2008 +0000

    Remove display colormaps from libgeda.
    
    Libgeda doesn't need to know about the color maps used by gschem at
    all. Add a generic function for initialising a color map to a built-in
    default, and get gschem to use it for its main and outline maps.

:100644 100644 d52b651... 2280868... M	gschem/include/prototype.h
:100644 100644 8394d54... 9c58d37... M	gschem/src/gschem.c
:100644 100644 f9f4ab1... 82a8c3f... M	gschem/src/x_color.c
:100644 100644 53a43da... 1142eed... M	libgeda/include/prototype.h
:100644 100644 bc3abbb... 877d492... M	libgeda/src/s_color.c

commit 9f5e54f022b73adb429633461ca88c81c394fd16
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:29:51 2008 +0000

    Remove (ab)use of "customary" colors.
    
    colors.h defines a number of color index index constants with color
    names (white, black, cyan, etc.) This is evil and bad, because the
    color map might actually be loaded with entirely different colors.
    
    This also adds a DEFAULT_COLOR macro, usable in most places the "evil"
    existing contacts are used.

:100644 100644 d201dfb... aa1435c... M	gschem/src/g_hook.c
:100644 100644 9f262ed... 480368f... M	gschem/src/o_complex.c
:100644 100644 ac4d50f... 7f6586f... M	gschem/src/o_misc.c
:100644 100644 e16e992... 479b880... M	gschem/src/o_net.c
:100644 100644 5366b41... 3c3f776... M	gschem/src/x_image.c
:100644 100644 da7e1eb... e9a9bd6... M	libgeda/include/colors.h
:100644 100644 ec35579... 0553b00... M	libgeda/src/o_arc_basic.c
:100644 100644 8bd4f79... d0334f7... M	libgeda/src/o_box_basic.c
:100644 100644 0b95b6f... b8efcb5... M	libgeda/src/o_bus_basic.c
:100644 100644 8b01c7d... dccb69f... M	libgeda/src/o_circle_basic.c
:100644 100644 a48b2cd... 82a319c... M	libgeda/src/o_complex_basic.c
:100644 100644 3681f6c... 5a18c2d... M	libgeda/src/o_line_basic.c
:100644 100644 d91b6a6... 8a88531... M	libgeda/src/o_net_basic.c
:100644 100644 6595fe2... 7952a48... M	libgeda/src/o_path_basic.c
:100644 100644 d9bde1a... 3e6b88c... M	libgeda/src/o_pin_basic.c
:100644 100644 3431b85... 2e1c813... M	libgeda/src/o_text_basic.c
:100644 100644 24822f9... 1f25519... M	libgeda/src/s_basic.c

commit a8b55895fd6833fa36ef92c6bc7c82490ea3a294
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:29:50 2008 +0000

    Remove legacy color Guile functions and variables.
    
    Remove the color-mapping functions and variables obsoleted by the new
    system.

:100644 100644 5296f2e... d52b651... M	gschem/include/prototype.h
:100644 100644 7fa38f2... 6c84ed8... M	gschem/src/g_rc.c
:100644 100644 059d896... c304e34... M	gschem/src/g_register.c
:100644 100644 42812b9... 8394d54... M	gschem/src/gschem.c
:100644 100644 ad39385... 53a43da... M	libgeda/include/prototype.h
:100644 100644 2f052eb... bc3abbb... M	libgeda/src/s_color.c

commit 06449db86b91db91bf5d4551acc2794cf34c97f1
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:29:47 2008 +0000

    New Scheme colormap syntax.
    
    Add new color map functions for setting multiple colors at a time with
    a simple list-based structure. Use one per color map rather than one
    per color.
    
    Use a wrapper macro in Scheme to make it easier to construct Scheme
    color map structures by using symbols instead of indexes to specify
    map entries.

:100644 100644 aa58252... 5296f2e... M	gschem/include/prototype.h
:100644 100644 28e1e82... 5496c16... M	gschem/lib/gschem-darkbg
:100644 100644 c856a09... dd42dbf... M	gschem/lib/gschem-lightbg
:100644 100644 8aea9ae... 07a7958... M	gschem/lib/system-gschemrc.in
:100644 100644 d390569... 7fa38f2... M	gschem/src/g_rc.c
:100644 100644 a6e4800... 059d896... M	gschem/src/g_register.c
:100644 100644 bb295e4... ad39385... M	libgeda/include/prototype.h
:100644 100644 2b53236... 8befc83... M	libgeda/include/prototype_priv.h
:100644 100644 f7d5a50... 91d124a... M	libgeda/lib/system-gafrc
:100644 100644 5f8d7b1... d51e79f... M	libgeda/scheme/Makefile.am
:000000 100644 0000000... 41dd8db... A	libgeda/scheme/color-map.scm
:100644 100644 a9da66d... 793ae31... M	libgeda/src/g_rc.c
:100644 100644 b78b97b... c254765... M	libgeda/src/g_register.c
:100644 100644 6e47437... 2f052eb... M	libgeda/src/s_color.c

commit af4756b843d6da32b8355a50bf3bb1f2bee0a539
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:20:17 2008 +0000

    Store colors as components rather than as strings.
    
    Rather than storing colors in libgeda as strings or GdkColor
    structures, store them as a set of four 8-bit unsigned integers.
    
    Since the GdkColor structure is renderer-specific, remove all trace of
    it from libgeda -- only gschem needs to know about it.

:100644 100644 f837e7b... f9f4ab1... M	gschem/src/x_color.c
:100644 100644 8af4c47... 963bda8... M	libgeda/include/globals.h
:100644 100644 813421a... 2b53236... M	libgeda/include/prototype_priv.h
:100644 100644 46b7f2c... a906eda... M	libgeda/include/struct.h
:100644 100644 b3e588a... 236ac71... M	libgeda/src/f_print.c
:100644 100644 a4857bd... 6e47437... M	libgeda/src/s_color.c

commit 05c77c57cc78b0963e52a91e6f56e8005089690a
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:20:14 2008 +0000

    Specify colors with RGB/RGBA hexadecimal notation only.
    
    Transparency (alpha channel) is used as follows for PostScript: if
    alpha is non-zero, objects are drawn fully opaque. If alpha is zero,
    objects are not drawn.
    
    The alpha channel is ignored for GDK drawing.

:100644 100644 f7b486d... 28e1e82... M	gschem/lib/gschem-darkbg
:100644 100644 e3db2a1... c856a09... M	gschem/lib/gschem-lightbg
:100644 100644 a81e081... f837e7b... M	gschem/src/x_color.c
:100644 100644 76ed88b... bb295e4... M	libgeda/include/prototype.h
:100644 100644 6e70553... 1cdd0ce... M	libgeda/po/POTFILES.in
:100644 100644 8cde130... a4857bd... M	libgeda/src/s_color.c

commit e2d6f2bfb1c24d5dfaf193dfae4aaa7cf4d0f236
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 00:36:27 2008 +0000

    Add explicit 'enabled' field to COLOR structure.
    
    Colors are implicitly 'enabled' by having values specified in the
    configuration file. Up until now, whether a given color is enabled has
    been checked by checking if the color name strings are NULL.
    
    This patch adds an explicit 'enabled' field to the COLOR structure. It
    is set TRUE when s_color_request() is called for that color index.

:100644 100644 7c455be... aa58252... M	gschem/include/prototype.h
:100644 100644 9a69b44... a81e081... M	gschem/src/x_color.c
:100644 100644 fadf6d4... 0848650... M	gschem/src/x_dialog.c
:100644 100644 50e0cc5... 46b7f2c... M	libgeda/include/struct.h
:100644 100644 aeba396... 8cde130... M	libgeda/src/s_color.c

=========
 Changes
=========

commit 04e17b33aea43f01079d2a0fd1ac9457062aa392
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:43:55 2008 +0000

    libgeda: Load confd files as last action in system-gafrc.
    
    Without loading the configuration files from the confd last in the
    system-gafrc, it is impossible to override e.g. attribute promotion
    settings from confd scripts.

diff --git a/libgeda/lib/system-gafrc b/libgeda/lib/system-gafrc
index 7b1663b..2789c00 100644
--- a/libgeda/lib/system-gafrc
+++ b/libgeda/lib/system-gafrc
@@ -36,12 +36,6 @@
       (load font-def-file)
       (display "Failed to load default font.\n")))
 
-;; The directory containing any extra scheme files to load
-(define geda-confd-path (build-path geda-data-path "gafrc.d"))
-
-;; Execute any scheme files found in the geda-confd-path directory.
-(load-scheme-dir geda-confd-path)
-
 ; Set the name of the postscript prolog file that will be 
 ; pasted into the postscript output after the DSC comments, but
 ; before the main script.
@@ -113,3 +107,11 @@
 (load (build-path geda-rc-path "print-colormap-lightbg")) ; light background
 ;(load (build-path geda-rc-path "print-colormap-darkbg")) ; dark background
 
+
+;;;; Process configuration script directory
+
+;; The directory containing any extra scheme files to load
+(define geda-confd-path (build-path geda-data-path "gafrc.d"))
+
+;; Execute any scheme files found in the geda-confd-path directory.
+(load-scheme-dir geda-confd-path)

commit 01bd6420ecad411d804f4a1a3d41af67d901ce6a
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:43:17 2008 +0000

    Use light background color maps as the default.
    
    The comments in the rc files have stated for a while that a light
    background is the default. Furthermore, all the cool CAD software uses
    light backgrounds these days.

diff --git a/gschem/lib/system-gschemrc.in b/gschem/lib/system-gschemrc.in
index e1a86cf..cc2142b 100644
--- a/gschem/lib/system-gschemrc.in
+++ b/gschem/lib/system-gschemrc.in
@@ -29,8 +29,8 @@
 ; Comment out the first line and comment in the second line for a
 ; dark (black) background.  The dark background is the original look. 
 ; 
-(load (build-path geda-rc-path "gschem-colormap-darkbg")) ; dark background
-;(load (build-path geda-rc-path "gschem-colormap-lightbg")) ; light background
+(load (build-path geda-rc-path "gschem-colormap-lightbg")) ; light background
+;(load (build-path geda-rc-path "gschem-colormap-darkbg")) ; dark background
 
 ;
 ; End of color section
diff --git a/libgeda/lib/system-gafrc b/libgeda/lib/system-gafrc
index f5d6713..7b1663b 100644
--- a/libgeda/lib/system-gafrc
+++ b/libgeda/lib/system-gafrc
@@ -110,5 +110,6 @@
 ; Comment out the first line and comment in the second line for a
 ; black background. The dark background is the original look.
 ;
-(load (build-path geda-rc-path "print-colormap-darkbg")) ; dark background
-;(load (build-path geda-rc-path "print-colormap-lightbg")) ; light background
+(load (build-path geda-rc-path "print-colormap-lightbg")) ; light background
+;(load (build-path geda-rc-path "print-colormap-darkbg")) ; dark background
+

commit 619aea627a81a5621036b0a2949e774bb5cb2e6e
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:42:46 2008 +0000

    Separate display and print color map config files.
    
    We should be able to print in color using libgeda without needing
    gschem.

diff --git a/gschem/lib/Makefile.am b/gschem/lib/Makefile.am
index 16eac04..d2cf22e 100644
--- a/gschem/lib/Makefile.am
+++ b/gschem/lib/Makefile.am
@@ -1,8 +1,8 @@
 
 rcdatadir = @GEDARCDIR@
-rcdata_DATA = system-gschemrc gschem-gtkrc gschem-lightbg gschem-darkbg
+rcdata_DATA = system-gschemrc gschem-gtkrc gschem-colormap-lightbg gschem-colormap-darkbg
 
-EXTRA_DIST = system-gschemrc.in gschem-gtkrc gschem-lightbg gschem-darkbg
+EXTRA_DIST = system-gschemrc.in gschem-gtkrc gschem-colormap-lightbg gschem-colormap-darkbg
 
 MOSTLYCLEANFILES = *.log *~
 CLEANFILES = *.log *~
diff --git a/gschem/lib/gschem-colormap-darkbg b/gschem/lib/gschem-colormap-darkbg
new file mode 100644
index 0000000..b2a2eff
--- /dev/null
+++ b/gschem/lib/gschem-colormap-darkbg
@@ -0,0 +1,65 @@
+;                                                         -*-Scheme-*-
+;
+; Dark background color map for gschem
+;
+
+;  ;'s are comments
+;  Keywords are case sensitive (Guile feature)
+;  Colors are not case sensitive
+;
+
+; Colors may be specified in "#RRGGBB" or "#RRGGBBAA" format. If the alpha
+; value is not specified, full opacity is assumed.
+;
+; If a color is #f (not a string; Scheme 'false'), then objects of
+; that color will never be drawn.
+
+(display-color-map
+ '((background         "#000000")
+   (pin                "#ffffff")
+   (net-endpoint       "#ff0000")
+   (graphic            "#00ff00")
+   (net                "#0000ff")
+   (attribute          "#ffff00")
+   (logic-bubble       "#00ffff")
+   (grid               "#bebebe")
+   (detached-attribute "#ff0000")
+   (text               "#00ff00")
+   (bus                "#00ff00")
+   (select             "#ffa500")
+   (bounding-box       "#ffa500")
+   (zoom-box           "#00ffff")
+   (stroke             "#e5e5e5")
+   (lock               "#bebebe")
+   (output-background  #f)
+   (junction           "#ffff00")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
+
+(display-outline-color-map
+ '((background         #f)
+   (pin                "#bebebe")
+   (net-endpoint       "#00cd00")
+   (graphic            "#00cd00")
+   (net                "#0000cd")
+   (attribute          "#cdcd00")
+   (logic-bubble       "#00cdcd")
+   (grid               #f)
+   (detached-attribute "#cd0000")
+   (text               "#00cd00")
+   (bus                "#00cd00")
+   (select             "#ffa500")
+   (bounding-box       "#ffa500")
+   (zoom-box           "#00ffff")
+   (stroke             "#e5e5e5")
+   (lock               "#a9a9a9")
+   (output-background  #f)
+   (junction           "#cdcd00")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
diff --git a/gschem/lib/gschem-colormap-lightbg b/gschem/lib/gschem-colormap-lightbg
new file mode 100644
index 0000000..aa658c4
--- /dev/null
+++ b/gschem/lib/gschem-colormap-lightbg
@@ -0,0 +1,65 @@
+;                                                         -*-Scheme-*-
+;
+; Light background color map for gschem
+;
+
+;  ;'s are comments
+;  Keywords are case sensitive (guile feature)
+;  Colors are not case sensitive
+;
+
+; Colors may be specified in "#RRGGBB" or "#RRGGBBAA" format. If the alpha
+; value is not specified, full opacity is assumed.
+;
+; If a color is #f (not a string; Scheme 'false'), then objects of
+; that color will never be drawn.
+
+(display-color-map
+ '((background         "#f0f0f0")
+   (pin                "#000000")
+   (net-endpoint       "#ff0000")
+   (graphic            "#008b00")
+   (net                "#00008b")
+   (attribute          "#000000")
+   (logic-bubble       "#008b8b")
+   (grid               "#7f7f7f")
+   (detached-attribute "#ff0000")
+   (text               "#008b00")
+   (bus                "#00ee00")
+   (select             "#b22222")
+   (bounding-box       "#ffa500")
+   (stroke             "#a020f0")
+   (zoom-box           "#008b8b")
+   (lock               "#666666")
+   (output-background  #f)
+   (junction           "#a020f0")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
+
+(display-outline-color-map
+ '((background         #f)
+   (pin                "#4d4d4d")
+   (net-endpoint       "#cdcdcd")
+   (graphic            "#008b00")
+   (net                "#0000cd")
+   (attribute          "#4d4d4d")
+   (logic-bubble       "#008b8b")
+   (grid               #f)
+   (detached-attribute "#cd0000")
+   (text               "#008b00")
+   (bus                "#00cd00")
+   (select             "#b22222")
+   (bounding-box       "#ffa500")
+   (zoom-box           "#008b8b")
+   (stroke             "#a020f0")
+   (lock               "#a9a9a9")
+   (output-background  #f)
+   (junction           "#7e26cd")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
diff --git a/gschem/lib/gschem-darkbg b/gschem/lib/gschem-darkbg
deleted file mode 100644
index 5496c16..0000000
--- a/gschem/lib/gschem-darkbg
+++ /dev/null
@@ -1,90 +0,0 @@
-;                                                         -*-Scheme-*-
-;
-; Dark background color map for gschem
-;
-
-;  ;'s are comments
-;  Keywords are case sensitive (Guile feature)
-;  Colors are not case sensitive
-;
-
-; Colors may be specified in "#RRGGBB" or "#RRGGBBAA" format. If the alpha
-; value is not specified, full opacity is assumed.
-;
-; If a color is #f (not a string; Scheme 'false'), then objects of
-; that color will never be drawn.
-
-(display-color-map
- '((background         "#000000")
-   (pin                "#ffffff")
-   (net-endpoint       "#ff0000")
-   (graphic            "#00ff00")
-   (net                "#0000ff")
-   (attribute          "#ffff00")
-   (logic-bubble       "#00ffff")
-   (grid               "#bebebe")
-   (detached-attribute "#ff0000")
-   (text               "#00ff00")
-   (bus                "#00ff00")
-   (select             "#ffa500")
-   (bounding-box       "#ffa500")
-   (zoom-box           "#00ffff")
-   (stroke             "#e5e5e5")
-   (lock               "#bebebe")
-   (output-background  #f)
-   (junction           "#ffff00")
-   (freestyle1         #f)
-   (freestyle2         #f)
-   (freestyle3         #f)
-   (freestyle4         #f)
-   ))
-
-(display-outline-color-map
- '((background         #f)
-   (pin                "#bebebe")
-   (net-endpoint       "#00cd00")
-   (graphic            "#00cd00")
-   (net                "#0000cd")
-   (attribute          "#cdcd00")
-   (logic-bubble       "#00cdcd")
-   (grid               #f)
-   (detached-attribute "#cd0000")
-   (text               "#00cd00")
-   (bus                "#00cd00")
-   (select             "#ffa500")
-   (bounding-box       "#ffa500")
-   (zoom-box           "#00ffff")
-   (stroke             "#e5e5e5")
-   (lock               "#a9a9a9")
-   (output-background  #f)
-   (junction           "#cdcd00")
-   (freestyle1         #f)
-   (freestyle2         #f)
-   (freestyle3         #f)
-   (freestyle4         #f)
-   ))
-
-(print-color-map
- '((background         #f)
-   (pin                "#ffffff")
-   (net-endpoint       "#ff0000")
-   (graphic            "#00ff00")
-   (net                "#0000ff")
-   (attribute          "#ffff00")
-   (logic-bubble       "#00ffff")
-   (grid               #f)
-   (detached-attribute "#ff0000")
-   (text               "#00ff00")
-   (bus                "#00ff00")
-   (select             #f)
-   (bounding-box       #f)
-   (zoom-box           #f)
-   (stroke             #f)
-   (lock               #f)
-   (output-background  "#000000")
-   (junction           "#ffff00")
-   (freestyle1         #f)
-   (freestyle2         #f)
-   (freestyle3         #f)
-   (freestyle4         #f)
-   ))
diff --git a/gschem/lib/gschem-lightbg b/gschem/lib/gschem-lightbg
deleted file mode 100644
index dd42dbf..0000000
--- a/gschem/lib/gschem-lightbg
+++ /dev/null
@@ -1,90 +0,0 @@
-;                                                         -*-Scheme-*-
-;
-; Light background color map for gschem
-;
-
-;  ;'s are comments
-;  Keywords are case sensitive (guile feature)
-;  Colors are not case sensitive
-;
-
-; Colors may be specified in "#RRGGBB" or "#RRGGBBAA" format. If the alpha
-; value is not specified, full opacity is assumed.
-;
-; If a color is #f (not a string; Scheme 'false'), then objects of
-; that color will never be drawn.
-
-(display-color-map
- '((background         "#f0f0f0")
-   (pin                "#000000")
-   (net-endpoint       "#ff0000")
-   (graphic            "#008b00")
-   (net                "#00008b")
-   (attribute          "#000000")
-   (logic-bubble       "#008b8b")
-   (grid               "#7f7f7f")
-   (detached-attribute "#ff0000")
-   (text               "#008b00")
-   (bus                "#00ee00")
-   (select             "#b22222")
-   (bounding-box       "#ffa500")
-   (stroke             "#a020f0")
-   (zoom-box           "#008b8b")
-   (lock               "#666666")
-   (output-background  #f)
-   (junction           "#a020f0")
-   (freestyle1         #f)
-   (freestyle2         #f)
-   (freestyle3         #f)
-   (freestyle4         #f)
-   ))
-
-(display-outline-color-map
- '((background         #f)
-   (pin                "#4d4d4d")
-   (net-endpoint       "#cdcdcd")
-   (graphic            "#008b00")
-   (net                "#0000cd")
-   (attribute          "#4d4d4d")
-   (logic-bubble       "#008b8b")
-   (grid               #f)
-   (detached-attribute "#cd0000")
-   (text               "#008b00")
-   (bus                "#00cd00")
-   (select             "#b22222")
-   (bounding-box       "#ffa500")
-   (zoom-box           "#008b8b")
-   (stroke             "#a020f0")
-   (lock               "#a9a9a9")
-   (output-background  #f)
-   (junction           "#7e26cd")
-   (freestyle1         #f)
-   (freestyle2         #f)
-   (freestyle3         #f)
-   (freestyle4         #f)
-   ))
-
-(print-color-map
- '((background         "#ffffff")
-   (pin                "#000000")
-   (net-endpoint       "#ff0000")
-   (graphic            "#008b00")
-   (net                "#0000ff")
-   (attribute          "#000000")
-   (logic-bubble       "#008b8b")
-   (grid               #f)
-   (detached-attribute "#ff0000")
-   (text               "#008b00")
-   (bus                "#00ee00")
-   (select             #f)
-   (bounding-box       #f)
-   (zoom-box           #f)
-   (stroke             #f)
-   (lock               "#666666")
-   (output-background  "#ffffff")
-   (junction           "#a020f0")
-   (freestyle1         #f)
-   (freestyle2         #f)
-   (freestyle3         #f)
-   (freestyle4         #f)
-   ))
diff --git a/gschem/lib/system-gschemrc.in b/gschem/lib/system-gschemrc.in
index 07a7958..e1a86cf 100644
--- a/gschem/lib/system-gschemrc.in
+++ b/gschem/lib/system-gschemrc.in
@@ -29,8 +29,8 @@
 ; Comment out the first line and comment in the second line for a
 ; dark (black) background.  The dark background is the original look. 
 ; 
-(load (build-path geda-rc-path "gschem-darkbg")) ; dark background
-;(load (build-path geda-rc-path "gschem-lightbg")) ; light background
+(load (build-path geda-rc-path "gschem-colormap-darkbg")) ; dark background
+;(load (build-path geda-rc-path "gschem-colormap-lightbg")) ; light background
 
 ;
 ; End of color section
diff --git a/libgeda/lib/Makefile.am b/libgeda/lib/Makefile.am
index 8a91114..5a40a8e 100644
--- a/libgeda/lib/Makefile.am
+++ b/libgeda/lib/Makefile.am
@@ -1,6 +1,6 @@
 
 rcdatadir = @GEDARCDIR@
-dist_rcdata_DATA = system-gafrc
+dist_rcdata_DATA = system-gafrc print-colormap-lightbg print-colormap-darkbg
 
 MOSTLYCLEANFILES = *.log *~
 CLEANFILES = *.log *~
diff --git a/libgeda/lib/print-colormap-darkbg b/libgeda/lib/print-colormap-darkbg
new file mode 100644
index 0000000..50f2a66
--- /dev/null
+++ b/libgeda/lib/print-colormap-darkbg
@@ -0,0 +1,40 @@
+;                                                         -*-Scheme-*-
+;
+; Dark background color map for printing
+;
+
+;  ;'s are comments
+;  Keywords are case sensitive (Guile feature)
+;  Colors are not case sensitive
+;
+
+; Colors may be specified in "#RRGGBB" or "#RRGGBBAA" format. If the alpha
+; value is not specified, full opacity is assumed.
+;
+; If a color is #f (not a string; Scheme 'false'), then objects of
+; that color will never be drawn.
+
+(print-color-map
+ '((background         #f)
+   (pin                "#ffffff")
+   (net-endpoint       "#ff0000")
+   (graphic            "#00ff00")
+   (net                "#0000ff")
+   (attribute          "#ffff00")
+   (logic-bubble       "#00ffff")
+   (grid               #f)
+   (detached-attribute "#ff0000")
+   (text               "#00ff00")
+   (bus                "#00ff00")
+   (select             #f)
+   (bounding-box       #f)
+   (zoom-box           #f)
+   (stroke             #f)
+   (lock               #f)
+   (output-background  "#000000")
+   (junction           "#ffff00")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
diff --git a/libgeda/lib/print-colormap-lightbg b/libgeda/lib/print-colormap-lightbg
new file mode 100644
index 0000000..f709816
--- /dev/null
+++ b/libgeda/lib/print-colormap-lightbg
@@ -0,0 +1,41 @@
+;                                                         -*-Scheme-*-
+;
+; Light background color map for gschem
+;
+
+;  ;'s are comments
+;  Keywords are case sensitive (guile feature)
+;  Colors are not case sensitive
+;
+
+; Colors may be specified in "#RRGGBB" or "#RRGGBBAA" format. If the alpha
+; value is not specified, full opacity is assumed.
+;
+; If a color is #f (not a string; Scheme 'false'), then objects of
+; that color will never be drawn.
+
+
+(print-color-map
+ '((background         "#ffffff")
+   (pin                "#000000")
+   (net-endpoint       "#ff0000")
+   (graphic            "#008b00")
+   (net                "#0000ff")
+   (attribute          "#000000")
+   (logic-bubble       "#008b8b")
+   (grid               #f)
+   (detached-attribute "#ff0000")
+   (text               "#008b00")
+   (bus                "#00ee00")
+   (select             #f)
+   (bounding-box       #f)
+   (zoom-box           #f)
+   (stroke             #f)
+   (lock               "#666666")
+   (output-background  "#ffffff")
+   (junction           "#a020f0")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
diff --git a/libgeda/lib/system-gafrc b/libgeda/lib/system-gafrc
index 91d124a..f5d6713 100644
--- a/libgeda/lib/system-gafrc
+++ b/libgeda/lib/system-gafrc
@@ -98,8 +98,17 @@
 ; End of attribute promotion keywords
 ; 
 
+;;;; Color maps
+
 ;; Load functions for handling color maps
 (load-from-path "color-map.scm")
 
 ;; Make the printing color map more user-friendly
 (color-map-make-friendly print-color-map)
+
+;; Load up a color scheme for printing which has a white background.
+; Comment out the first line and comment in the second line for a
+; black background. The dark background is the original look.
+;
+(load (build-path geda-rc-path "print-colormap-darkbg")) ; dark background
+;(load (build-path geda-rc-path "print-colormap-lightbg")) ; light background

commit 12d9e2127329a880ed8532808635d3ffdbf46caa
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:29:51 2008 +0000

    Remove display colormaps from libgeda.
    
    Libgeda doesn't need to know about the color maps used by gschem at
    all. Add a generic function for initialising a color map to a built-in
    default, and get gschem to use it for its main and outline maps.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index d52b651..2280868 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -721,6 +721,7 @@ void x_basic_warp_cursor(GtkWidget *widget, gint x, gint y);
 /* x_color.c */
 void x_color_init (void);
 void x_color_free (void);
+void x_color_allocate (void);
 GdkColor *x_get_color(int color);
 GdkColor *x_get_darkcolor(int color);
 gchar *x_color_get_name(int index);
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index 8394d54..9c58d37 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -220,6 +220,9 @@ void main_prog(void *closure, int argc, char *argv[])
   /* register guile (scheme) functions */
   g_register_funcs();
 
+  /* initialise color map (need to do this before reading rc files */
+  x_color_init ();
+
   o_undo_init(); 
 
   geda_data = getenv("GEDADATA");
@@ -265,7 +268,7 @@ void main_prog(void *closure, int argc, char *argv[])
 
   /* At end, complete set up of window. */
   colormap = gdk_colormap_get_system ();
-  x_color_init();
+  x_color_allocate();
   x_window_setup (w_current);
 
 #ifdef HAS_LIBSTROKE
diff --git a/gschem/src/x_color.c b/gschem/src/x_color.c
index f9f4ab1..82a8c3f 100644
--- a/gschem/src/x_color.c
+++ b/gschem/src/x_color.c
@@ -31,43 +31,23 @@
 #include <dmalloc.h>
 #endif
 
-extern COLOR display_colors[MAX_COLORS];
-extern COLOR display_outline_colors[MAX_COLORS];
+COLOR display_colors[MAX_COLORS];
+COLOR display_outline_colors[MAX_COLORS];
 
 static GdkColor* gdk_colors[MAX_COLORS];
 static GdkColor* gdk_outline_colors[MAX_COLORS];
 
-static void x_color_allocate_all(void);
-
 /*! \brief Initializes the color system for the application.
  *  \par Function Documentation
- *  This function initializes the default \b black and \b white color.
  *
- *  It also allocates the colormap.
+ *  Initialises the color maps to defaults.
  */
 void
 x_color_init (void)
 {
-  gdk_color_parse ("black", &black);
-  if (!gdk_colormap_alloc_color (colormap,
-                                 &black,
-                                 FALSE,
-                                 TRUE)) {
-    fprintf (stderr, _("Could not allocate the color %s!\n"), _("black"));
-    exit (-1);
-  }
-
-  gdk_color_parse ("white", &white);
-  if (!gdk_colormap_alloc_color (colormap,
-                                 &white,
-                                 FALSE,
-                                 TRUE)) {
-    fprintf (stderr, _("Could not allocate the color %s!\n"), _("white"));
-    exit (-1);
-  }
-
-  x_color_allocate_all ();
-
+  /* Initialise default color maps */
+  s_color_map_defaults (display_colors);
+  s_color_map_defaults (display_outline_colors);
 }
 
 /*! \brief Frees memory used by the color system.
@@ -89,12 +69,30 @@ x_color_free (void)
  *  \par Function Documentation
  *
  */
-static void x_color_allocate_all(void)
+void x_color_allocate (void)
 {
   int error;
   int i;		
   COLOR c;
 
+  gdk_color_parse ("black", &black);
+  if (!gdk_colormap_alloc_color (colormap,
+                                 &black,
+                                 FALSE,
+                                 TRUE)) {
+    fprintf (stderr, _("Could not allocate the color %s!\n"), _("black"));
+    exit (-1);
+  }
+
+  gdk_color_parse ("white", &white);
+  if (!gdk_colormap_alloc_color (colormap,
+                                 &white,
+                                 FALSE,
+                                 TRUE)) {
+    fprintf (stderr, _("Could not allocate the color %s!\n"), _("white"));
+    exit (-1);
+  }
+
   for (i = 0; i < MAX_COLORS; i++) {
 
     if (display_colors[i].enabled) {
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 53a43da..1142eed 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -352,6 +352,7 @@ gchar *s_clib_symbol_get_data_by_name (const gchar *name);
 GList *s_toplevel_get_symbols (const TOPLEVEL *toplevel);
 
 /* s_color.c */
+void s_color_map_defaults (COLOR *map);
 gboolean s_color_rgba_decode (const gchar *rgba,
                               guchar *r, guchar *g, guchar *b, guchar *a);
 gchar *s_color_rgba_encode (guint8 r, guint8 g, guint8 b, guint8 a);
diff --git a/libgeda/src/s_color.c b/libgeda/src/s_color.c
index bc3abbb..877d492 100644
--- a/libgeda/src/s_color.c
+++ b/libgeda/src/s_color.c
@@ -32,30 +32,76 @@
 #endif
 
 COLOR print_colors[MAX_COLORS];
-COLOR display_colors[MAX_COLORS]; /* FIXME move into gschem */
-COLOR display_outline_colors[MAX_COLORS]; /* FIXME move into gschem */
 
-/*! \brief Initialise the color maps to B&W
+#define NOCOLOR {0xff, 0xff, 0xff, 0xff, FALSE}
+#define WHITE   {0xff, 0xff, 0xff, 0xff, TRUE}
+#define GRAY    {0x88, 0x88, 0x88, 0xff, TRUE}
+#define BLACK   {0x00, 0x00, 0x00, 0xff, TRUE}
+#define ENDMAP  {0x00, 0x00, 0x00, 0x00, FALSE}
+
+static COLOR default_colors[] = {
+  WHITE,           /* background         */
+  BLACK,           /* pin                */
+  BLACK,           /* net-endpoint       */
+  BLACK,           /* graphic            */
+  BLACK,           /* net                */
+  BLACK,           /* attribute          */
+  BLACK,           /* logic-bubble       */
+  BLACK,           /* grid               */
+  BLACK,           /* detached-attribute */
+  BLACK,           /* text               */
+  BLACK,           /* bus                */
+  GRAY,            /* select             */
+  GRAY,            /* bounding-box       */
+  GRAY,            /* zoom-box           */
+  GRAY,            /* stroke             */
+  BLACK,           /* lock               */
+  NOCOLOR,         /* output-background  */
+  BLACK,           /* junction           */
+  NOCOLOR,         /* freestyle1         */
+  NOCOLOR,         /* freestyle2         */
+  NOCOLOR,         /* freestyle3         */
+  NOCOLOR,         /* freestyle4         */
+  ENDMAP
+};
+
+/*! \brief Initialises the color subsystem
+ *  \par Function Description
+ *  At the moment, just initialises the print color map.
+ */
+void
+s_color_init(void)
+{
+  s_color_map_defaults (print_colors);
+}
+
+/*! \brief Initialise a color map to B&W
  *  \par Function Description
- *  Initialises the print & display color maps to display black
- *  features on a white background, with all colors disabled.
+ *  Initialises a color map to a simple default: black features on a
+ *  white background, with "special" colors as gray.
  *
- *  \todo This should set a sensible default set of colors to be
- *  enabled.
+ *  \warning \a map must be have length of at least #MAX_COLORS.
+ *
+ *  \param map Color map to initialise.
  */
-void s_color_init(void)
+void
+s_color_map_defaults (COLOR *map)
 {
   int i;
-  COLOR white = {0xff, 0xff, 0xff, 0xff, FALSE};
-  COLOR black = {0x00, 0x00, 0x00, 0xff, FALSE};
-
-  print_colors[0] = white;
-  display_colors[0] = white;
-  display_outline_colors[0] = white;
-  for (i = 1; i < MAX_COLORS; i++) {
-    print_colors[i] = black;
-    display_colors[i] = black;
-    display_outline_colors[i] = black;
+  gboolean reached_end = FALSE;
+  COLOR c;
+  for (i = 0; i < MAX_COLORS; i++) {
+    if (reached_end) {
+      map[i].enabled = FALSE;
+      continue;
+    }
+    c = default_colors[i];
+    if (c.a == 0) { /* Check for end of default map */
+      reached_end = TRUE;
+      i--;
+      continue;
+    }
+    map[i] = c;
   }
 }
 

commit 9f5e54f022b73adb429633461ca88c81c394fd16
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:29:51 2008 +0000

    Remove (ab)use of "customary" colors.
    
    colors.h defines a number of color index index constants with color
    names (white, black, cyan, etc.) This is evil and bad, because the
    color map might actually be loaded with entirely different colors.
    
    This also adds a DEFAULT_COLOR macro, usable in most places the "evil"
    existing contacts are used.

diff --git a/gschem/src/g_hook.c b/gschem/src/g_hook.c
index d201dfb..aa1435c 100644
--- a/gschem/src/g_hook.c
+++ b/gschem/src/g_hook.c
@@ -704,7 +704,7 @@ SCM g_add_component(SCM page_smob, SCM scm_comp_name, SCM scm_x, SCM scm_y,
 
   clib = s_clib_get_symbol_by_name (comp_name);
 
-  new_obj = o_complex_new (toplevel, 'C', WHITE, x, y, angle, mirror,
+  new_obj = o_complex_new (toplevel, 'C', DEFAULT_COLOR, x, y, angle, mirror,
                            clib, comp_name, selectable);
   s_page_append (page, new_obj);
   o_complex_promote_attribs (toplevel, new_obj, &page->object_list);
diff --git a/gschem/src/o_complex.c b/gschem/src/o_complex.c
index 9f262ed..480368f 100644
--- a/gschem/src/o_complex.c
+++ b/gschem/src/o_complex.c
@@ -107,8 +107,8 @@ void o_complex_prepare_place(GSCHEM_TOPLEVEL *w_current, const char *sym_name)
 
     toplevel->ADDING_SEL = 1; /* reuse this flag, rename later hack */
     sym = s_clib_get_symbol_by_name (sym_name);
-    new_object = o_complex_new (toplevel, OBJ_COMPLEX, WHITE, 0, 0, 0, 0,
-                                sym, sym_name, 1);
+    new_object = o_complex_new (toplevel, OBJ_COMPLEX, DEFAULT_COLOR,
+                                0, 0, 0, 0, sym, sym_name, 1);
 
     toplevel->page_current->place_list =
       g_list_append (toplevel->page_current->place_list, new_object);
diff --git a/gschem/src/o_misc.c b/gschem/src/o_misc.c
index ac4d50f..7f6586f 100644
--- a/gschem/src/o_misc.c
+++ b/gschem/src/o_misc.c
@@ -703,7 +703,7 @@ void o_update_component(GSCHEM_TOPLEVEL *w_current, OBJECT *o_current)
   /* and unselect it */
   o_selection_remove( toplevel->page_current->selection_list, o_current);
 
-  new_complex = o_complex_new (toplevel, OBJ_COMPLEX, WHITE,
+  new_complex = o_complex_new (toplevel, OBJ_COMPLEX, DEFAULT_COLOR,
                                o_current->complex->x,
                                o_current->complex->y,
                                o_current->complex->angle,
diff --git a/gschem/src/o_net.c b/gschem/src/o_net.c
index e16e992..479b880 100644
--- a/gschem/src/o_net.c
+++ b/gschem/src/o_net.c
@@ -1280,7 +1280,7 @@ int o_net_add_busrippers(GSCHEM_TOPLEVEL *w_current, OBJECT *net_obj,
       } else {
 
         if (rippersym != NULL) {
-          new_obj = o_complex_new (toplevel, OBJ_COMPLEX, WHITE,
+          new_obj = o_complex_new (toplevel, OBJ_COMPLEX, DEFAULT_COLOR,
                                    rippers[i].x[0], rippers[i].y[0],
                                    complex_angle, 0,
                                    rippersym,
diff --git a/gschem/src/x_image.c b/gschem/src/x_image.c
index 5366b41..3c3f776 100644
--- a/gschem/src/x_image.c
+++ b/gschem/src/x_image.c
@@ -664,12 +664,16 @@ GdkPixbuf *x_image_get_pixbuf (GSCHEM_TOPLEVEL *w_current)
 
   if (toplevel.image_color == FALSE)
   {
+    /* FIXME this assumes -- not necessarily correctly! -- that the
+     * color at index 0 in the color map is black, and the color at
+     * index 1 is white! */
+
     /* We are going to be doing black&white (grayscale) output, so change the */
     /* color of all objects to a nice and dark color, say black */
-    toplevel.override_color = BLACK;  
+    toplevel.override_color = 0;
 
     /* also reset the background to white */
-    toplevel.background_color = WHITE;
+    toplevel.background_color = 1;
   }
 
   origin_x = origin_y = 0;
diff --git a/libgeda/include/colors.h b/libgeda/include/colors.h
index da7e1eb..e9a9bd6 100644
--- a/libgeda/include/colors.h
+++ b/libgeda/include/colors.h
@@ -51,16 +51,6 @@
 #define OVERRIDE_PIN_COLOR              1
 #define OVERRIDE_BUS_COLOR              10
 
-#define BLACK           0
-#define WHITE           1
-#define RED             2
-#define GREEN           3
-#define BLUE            4
-#define YELLOW          5
-#define CYAN            6
-#define GREY            7
-
-/* Internal colors, please don't use these in schematics */
-#define GREY90          8
+#define DEFAULT_COLOR                   3
 
 #endif
diff --git a/libgeda/src/o_arc_basic.c b/libgeda/src/o_arc_basic.c
index ec35579..0553b00 100644
--- a/libgeda/src/o_arc_basic.c
+++ b/libgeda/src/o_arc_basic.c
@@ -285,8 +285,8 @@ OBJECT *o_arc_read (TOPLEVEL *toplevel, char buf[],
 	
   if (color < 0 || color > MAX_COLORS) {
     s_log_message(_("Found an invalid color [ %s ]\n"), buf);
-    s_log_message(_("Setting color to WHITE\n"));
-    color = WHITE;
+    s_log_message(_("Setting color to default color\n"));
+    color = DEFAULT_COLOR;
   }
 
   /* Allocation and initialization */
diff --git a/libgeda/src/o_box_basic.c b/libgeda/src/o_box_basic.c
index 8bd4f79..d0334f7 100644
--- a/libgeda/src/o_box_basic.c
+++ b/libgeda/src/o_box_basic.c
@@ -299,8 +299,8 @@ OBJECT *o_box_read (TOPLEVEL *toplevel, char buf[],
 
   if (color < 0 || color > MAX_COLORS) {
     s_log_message (_("Found an invalid color [ %s ]\n"), buf);
-    s_log_message (_("Setting color to WHITE\n"));
-    color = WHITE;
+    s_log_message (_("Setting color to default color\n"));
+    color = DEFAULT_COLOR;
   }
 
   /*! \note
diff --git a/libgeda/src/o_bus_basic.c b/libgeda/src/o_bus_basic.c
index 0b95b6f..b8efcb5 100644
--- a/libgeda/src/o_bus_basic.c
+++ b/libgeda/src/o_bus_basic.c
@@ -170,8 +170,8 @@ OBJECT *o_bus_read (TOPLEVEL *toplevel, char buf[],
 
   if (color < 0 || color > MAX_COLORS) {
     s_log_message (_("Found an invalid color [ %s ]\n"), buf);
-    s_log_message (_("Setting color to WHITE\n"));
-    color = WHITE;
+    s_log_message (_("Setting color to default color\n"));
+    color = DEFAULT_COLOR;
   }
 
   if (ripper_dir < -1 || ripper_dir > 1) {
diff --git a/libgeda/src/o_circle_basic.c b/libgeda/src/o_circle_basic.c
index 8b01c7d..dccb69f 100644
--- a/libgeda/src/o_circle_basic.c
+++ b/libgeda/src/o_circle_basic.c
@@ -291,8 +291,8 @@ OBJECT *o_circle_read (TOPLEVEL *toplevel, char buf[],
   
   if (color < 0 || color > MAX_COLORS) {
     s_log_message(_("Found an invalid color [ %s ]\n"), buf);
-    s_log_message(_("Setting color to WHITE\n"));
-    color = WHITE;
+    s_log_message(_("Setting color to default color\n"));
+    color = DEFAULT_COLOR;
   }
 
   /* 
diff --git a/libgeda/src/o_complex_basic.c b/libgeda/src/o_complex_basic.c
index a48b2cd..82a319c 100644
--- a/libgeda/src/o_complex_basic.c
+++ b/libgeda/src/o_complex_basic.c
@@ -705,7 +705,7 @@ OBJECT *o_complex_read (TOPLEVEL *toplevel,
   if (strncmp(basename, "EMBEDDED", 8) == 0) {
     
     new_obj = o_complex_new_embedded(toplevel, type,
-                                     WHITE, x1, y1, angle, mirror,
+                                     DEFAULT_COLOR, x1, y1, angle, mirror,
                                      basename + 8,
                                      selectable);
   } else {
@@ -713,7 +713,7 @@ OBJECT *o_complex_read (TOPLEVEL *toplevel,
     const CLibSymbol *clib = s_clib_get_symbol_by_name (basename);
 
     new_obj = o_complex_new(toplevel, type,
-                                WHITE, 
+                                DEFAULT_COLOR,
                                 x1, y1, 
                                 angle, mirror, clib,
                                 basename, selectable);
diff --git a/libgeda/src/o_line_basic.c b/libgeda/src/o_line_basic.c
index 3681f6c..5a18c2d 100644
--- a/libgeda/src/o_line_basic.c
+++ b/libgeda/src/o_line_basic.c
@@ -267,8 +267,8 @@ OBJECT *o_line_read (TOPLEVEL *toplevel, char buf[],
 
   if (color < 0 || color > MAX_COLORS) {
     s_log_message (_("Found an invalid color [ %s ]\n"), buf);
-    s_log_message (_("Setting color to WHITE\n"));
-    color = WHITE;
+    s_log_message (_("Setting color to default color\n"));
+    color = DEFAULT_COLOR;
   }
 
   /*
diff --git a/libgeda/src/o_net_basic.c b/libgeda/src/o_net_basic.c
index d91b6a6..8a88531 100644
--- a/libgeda/src/o_net_basic.c
+++ b/libgeda/src/o_net_basic.c
@@ -162,8 +162,8 @@ OBJECT *o_net_read (TOPLEVEL *toplevel, char buf[],
 
   if (color < 0 || color > MAX_COLORS) {
     s_log_message (_("Found an invalid color [ %s ]\n"), buf);
-    s_log_message (_("Setting color to WHITE\n"));
-    color = WHITE;
+    s_log_message (_("Setting color to default color\n"));
+    color = DEFAULT_COLOR;
   }
 
   new_obj = o_net_new (toplevel, type, color, x1, y1, x2, y2);
diff --git a/libgeda/src/o_path_basic.c b/libgeda/src/o_path_basic.c
index 6595fe2..7952a48 100644
--- a/libgeda/src/o_path_basic.c
+++ b/libgeda/src/o_path_basic.c
@@ -197,8 +197,8 @@ OBJECT *o_path_read (TOPLEVEL *toplevel,
    */
   if (color < 0 || color > MAX_COLORS) {
     s_log_message (_("Found an invalid color [ %s ]\n"), first_line);
-    s_log_message (_("Setting color to WHITE\n"));
-    color = WHITE;
+    s_log_message (_("Setting color to default color\n"));
+    color = DEFAULT_COLOR;
   }
 
   /*
diff --git a/libgeda/src/o_pin_basic.c b/libgeda/src/o_pin_basic.c
index d9bde1a..3e6b88c 100644
--- a/libgeda/src/o_pin_basic.c
+++ b/libgeda/src/o_pin_basic.c
@@ -173,8 +173,8 @@ OBJECT *o_pin_read (TOPLEVEL *toplevel, char buf[],
 
   if (color < 0 || color > MAX_COLORS) {
     s_log_message (_("Found an invalid color [ %s ]\n"), buf);
-    s_log_message (_("Setting color to WHITE\n"));
-    color = WHITE;
+    s_log_message (_("Setting color to default color\n"));
+    color = DEFAULT_COLOR;
   }
 
   if (toplevel->override_pin_color != -1) {
diff --git a/libgeda/src/o_text_basic.c b/libgeda/src/o_text_basic.c
index 3431b85..2e1c813 100644
--- a/libgeda/src/o_text_basic.c
+++ b/libgeda/src/o_text_basic.c
@@ -1128,8 +1128,8 @@ OBJECT *o_text_read (TOPLEVEL *toplevel,
 
   if (color < 0 || color > MAX_COLORS) {
     s_log_message(_("Found an invalid color [ %s ]\n"), first_line);
-    s_log_message(_("Setting color to WHITE\n"));
-    color = WHITE;
+    s_log_message(_("Setting color to default color\n"));
+    color = DEFAULT_COLOR;
   }
 
   g_assert(num_lines && num_lines > 0);
diff --git a/libgeda/src/s_basic.c b/libgeda/src/s_basic.c
index 24822f9..1f25519 100644
--- a/libgeda/src/s_basic.c
+++ b/libgeda/src/s_basic.c
@@ -106,7 +106,7 @@ OBJECT *s_basic_init_object(OBJECT *new_node, int type, char const *name)
   new_node->complex_parent = NULL;
 		
   /* Setup the color */
-  new_node->color = WHITE;
+  new_node->color = DEFAULT_COLOR;
   new_node->saved_color = -1;
   new_node->selected = FALSE;
   new_node->dont_redraw = FALSE;

commit a8b55895fd6833fa36ef92c6bc7c82490ea3a294
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:29:50 2008 +0000

    Remove legacy color Guile functions and variables.
    
    Remove the color-mapping functions and variables obsoleted by the new
    system.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 5296f2e..d52b651 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -190,28 +190,6 @@ SCM g_get_selected_component_attributes(void);
 /* g_rc.c */
 void g_rc_parse_gtkrc();
 SCM g_rc_gschem_version(SCM version);
-SCM g_rc_override_net_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_override_bus_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_override_pin_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_attribute_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_detachedattr_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_text_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_net_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_bus_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_pin_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_graphic_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_grid_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_background_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_select_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_boundingbox_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_zoom_box_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_net_endpoint_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_junction_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_logic_bubble_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_lock_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_output_color_background(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_stroke_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
-SCM g_rc_freestyle_color(SCM index, SCM color, SCM outline_color, SCM ps_color);
 SCM g_rc_net_endpoint_mode(SCM mode);
 SCM g_rc_net_midpoint_mode(SCM mode);
 SCM g_rc_net_direction_mode(SCM mode);
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index 7fa38f2..6c84ed8 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -41,9 +41,6 @@
 #include <dmalloc.h>
 #endif
 
-/*! a random int, used only as a place holder */
-static int default_dummy;
-
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
@@ -99,152 +96,6 @@ SCM g_rc_gschem_version(SCM version)
 }
 
 /*! \todo Finish function documentation!!!
- *  \brief General color setting function
- *  \par Function Description
- *
- */
-static SCM g_rc_color_general(SCM index, SCM color, SCM outline_color, 
-			      SCM ps_color, const char *rc_name,
-                              int *color_var)
-{
-  int status;
-  int color_index;
-  char *color_name;
-  char *outline_color_name;
-  char *ps_color_string;
-  SCM ret;
-
-  SCM_ASSERT (scm_is_integer (index),   index, SCM_ARG1, rc_name);
-  SCM_ASSERT (scm_is_string (color), color, SCM_ARG2, rc_name);
-  SCM_ASSERT (scm_is_string (outline_color),
-              outline_color, SCM_ARG3, rc_name);
-  SCM_ASSERT (scm_is_string (ps_color), ps_color,
-              SCM_ARG4, rc_name);
-
-  color_index        = scm_to_int (index);
-  color_name         = SCM_STRING_CHARS (color);
-  outline_color_name = SCM_STRING_CHARS (outline_color);
-  ps_color_string    = SCM_STRING_CHARS (ps_color);
-  
-  status = s_color_request (color_index, color_name, outline_color_name,
-                            ps_color_string);
-
-#if DEBUG
-  printf("%d %s %s %s\n", color_index, color_name, 
-         outline_color_name, ps_color_string);
-#endif
-
-  /* invalid color? */
-  if (status == -1) {
-    fprintf (stderr,
-             _("Invalid color [%s] passed to %s\n"),
-             color_name,
-             rc_name);
-    ret = SCM_BOOL_F;
-  } else {
-    *color_var = color_index;
-    ret = SCM_BOOL_T;
-  }
-  
-  return ret;
-}
-
-#define DEFINE_G_RC_COLOR(func, rc, var)                         \
-SCM func(SCM index, SCM color, SCM outline_color, SCM ps_color)  \
-{                                                                \
-  return g_rc_color_general(index, color, outline_color,         \
-                            ps_color, (rc), &(var));             \
-}
-
-DEFINE_G_RC_COLOR(g_rc_override_net_color,
-		  "override-net-color",
-		  default_override_net_color)
-
-DEFINE_G_RC_COLOR(g_rc_override_bus_color,
-		  "override-bus-color",
-		  default_override_bus_color)
-
-DEFINE_G_RC_COLOR(g_rc_override_pin_color,
-		  "override-pin-color",
-		  default_override_pin_color)
-
-DEFINE_G_RC_COLOR(g_rc_attribute_color,
-		  "attribute-color",
-		  default_attribute_color)
-
-DEFINE_G_RC_COLOR(g_rc_detachedattr_color,
-		  "detached-attribute-color",
-		  default_detachattr_color)
-
-DEFINE_G_RC_COLOR(g_rc_text_color,
-		  "text-color",
-		  default_text_color)
-
-DEFINE_G_RC_COLOR(g_rc_net_color,
-		  "net-color",
-		  default_net_color)
-
-DEFINE_G_RC_COLOR(g_rc_bus_color,
-		  "bus-color",
-		  default_bus_color)
-
-DEFINE_G_RC_COLOR(g_rc_pin_color,
-		  "pin-color",
-		  default_pin_color)
-
-DEFINE_G_RC_COLOR(g_rc_graphic_color,
-		  "graphic-color",
-		  default_graphic_color)
-
-DEFINE_G_RC_COLOR(g_rc_grid_color,
-		  "grid-color",
-		  default_grid_color)
-
-DEFINE_G_RC_COLOR(g_rc_background_color,
-		  "background-color",
-		  default_background_color)
-
-DEFINE_G_RC_COLOR(g_rc_select_color,
-		  "select-color",
-		  default_select_color)
-
-DEFINE_G_RC_COLOR(g_rc_boundingbox_color,
-		  "boundingbox-color",
-		  default_bb_color)
-
-DEFINE_G_RC_COLOR(g_rc_zoom_box_color,
-		  "zoom-box-color",
-		  default_zoom_box_color)
-
-DEFINE_G_RC_COLOR(g_rc_net_endpoint_color,
-		  "net-endpoint-color",
-		  default_net_endpoint_color)
-
-DEFINE_G_RC_COLOR(g_rc_junction_color,
-		  "junction-color",
-		  default_junction_color)
-
-DEFINE_G_RC_COLOR(g_rc_logic_bubble_color,
-		  "logic-bubble-color",
-		  default_logic_bubble_color)
-
-DEFINE_G_RC_COLOR(g_rc_lock_color,
-		  "lock-color",
-		  default_lock_color)
-
-DEFINE_G_RC_COLOR(g_rc_output_color_background,
-		  "output-color-background",
-		  default_print_color_background)
-
-DEFINE_G_RC_COLOR(g_rc_stroke_color,
-		  "stroke-color",
-		  default_stroke_color)
-
-DEFINE_G_RC_COLOR(g_rc_freestyle_color,
-		  "freestyle-color",
-		  default_dummy)
-
-/*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
  *
diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c
index 059d896..c304e34 100644
--- a/gschem/src/g_register.c
+++ b/gschem/src/g_register.c
@@ -50,29 +50,6 @@ struct gsubr_t {
 static struct gsubr_t gschem_funcs[] = {
   /* rc file */
   { "gschem-version",           1, 0, 0, g_rc_gschem_version },
-  
-  { "override-net-color",       4, 0, 0, g_rc_override_net_color },
-  { "override-bus-color",       4, 0, 0, g_rc_override_bus_color },
-  { "override-pin-color",       4, 0, 0, g_rc_override_pin_color },
-  { "attribute-color",          4, 0, 0, g_rc_attribute_color },
-  { "detached-attribute-color", 4, 0, 0, g_rc_detachedattr_color },
-  { "text-color",               4, 0, 0, g_rc_text_color },
-  { "logic-bubble-color",       4, 0, 0, g_rc_logic_bubble_color },
-  { "lock-color",               4, 0, 0, g_rc_lock_color },
-  { "zoom-box-color",           4, 0, 0, g_rc_zoom_box_color },
-  { "net-color",                4, 0, 0, g_rc_net_color },
-  { "bus-color",                4, 0, 0, g_rc_bus_color },
-  { "pin-color",                4, 0, 0, g_rc_pin_color },
-  { "graphic-color",            4, 0, 0, g_rc_graphic_color },
-  { "grid-color",               4, 0, 0, g_rc_grid_color },
-  { "background-color",         4, 0, 0, g_rc_background_color },
-  { "select-color",             4, 0, 0, g_rc_select_color },
-  { "boundingbox-color",        4, 0, 0, g_rc_boundingbox_color },
-  { "net-endpoint-color",       4, 0, 0, g_rc_net_endpoint_color },
-  { "junction-color",           4, 0, 0, g_rc_junction_color },
-  { "stroke-color",             4, 0, 0, g_rc_stroke_color },
-  { "output-color-background",  4, 0, 0, g_rc_output_color_background },
-  { "freestyle-color",          4, 0, 0, g_rc_freestyle_color },
 
   { "display-color-map",        0, 1, 0, g_rc_display_color_map },
   { "display-outline-color-map", 0, 1, 0, g_rc_display_outline_color_map },
diff --git a/gschem/src/gschem.c b/gschem/src/gschem.c
index 42812b9..8394d54 100644
--- a/gschem/src/gschem.c
+++ b/gschem/src/gschem.c
@@ -96,7 +96,6 @@ void gschem_quit(void)
 #ifdef HAS_LIBSTROKE
   x_stroke_free ();
 #endif /* HAS_LIBSTROKE */
-  s_color_destroy_all();
   o_undo_cleanup();
   /* s_stroke_free(); no longer needed */
 
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index ad39385..53a43da 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -355,8 +355,6 @@ GList *s_toplevel_get_symbols (const TOPLEVEL *toplevel);
 gboolean s_color_rgba_decode (const gchar *rgba,
                               guchar *r, guchar *g, guchar *b, guchar *a);
 gchar *s_color_rgba_encode (guint8 r, guint8 g, guint8 b, guint8 a);
-int s_color_request(int color_index, char *color_string, char *outline_color_string, char *ps_color_string);
-void s_color_destroy_all(void);
 SCM s_color_map_to_scm (const COLOR *map);
 void s_color_map_from_scm (COLOR *map, SCM lst, const char *scheme_proc_name);
 
diff --git a/libgeda/src/s_color.c b/libgeda/src/s_color.c
index 2f052eb..bc3abbb 100644
--- a/libgeda/src/s_color.c
+++ b/libgeda/src/s_color.c
@@ -146,76 +146,6 @@ s_color_rgba_encode (guint8 r, guint8 g, guint8 b, guint8 a)
  *  \par Function Description
  *
  */
-/* you are allowed to call this function with the same color index again and */
-/* and again, last call is the final color request */
-int
-s_color_request(int color_index, char *color_string,
-                char *outline_color_string, char *ps_color_string)
-{
-  guint8 r, g, b, a;
-  gboolean res;
-
-#if 0
-  if (colors[color_index].color_name) {
-    return;
-  }
-#endif
-
-  if (color_index > MAX_COLORS) {
-    fprintf(stderr, "Cannot allocate specified color, increase MAX_COLORS\n");
-    return(-1);
-  } 
-
-  res = s_color_rgba_decode (color_string, &r, &g, &b, &a);
-  if (!res) {
-    g_warning (_("Could not decode color: \"%s\".\n"),
-               color_string);
-  } else {
-    display_colors[color_index].r = r;
-    display_colors[color_index].g = g;
-    display_colors[color_index].b = b;
-    display_colors[color_index].enabled = TRUE;
-  }
-
-  res = s_color_rgba_decode (outline_color_string, &r, &g, &b, &a);
-  if (!res) {
-    g_warning (_("Could not decode color: \"%s\".\n"),
-               outline_color_string);
-  } else {
-    display_outline_colors[color_index].r = r;
-    display_outline_colors[color_index].g = g;
-    display_outline_colors[color_index].b = b;
-    display_outline_colors[color_index].enabled = TRUE;
-  }
-
-  res = s_color_rgba_decode (ps_color_string, &r, &g, &b, &a);
-  if (!res) {
-    g_warning (_("Could not decode color: \"%s\".\n"),
-               ps_color_string);
-  } else {
-    print_colors[color_index].r = r;
-    print_colors[color_index].g = g;
-    print_colors[color_index].b = b;
-    print_colors[color_index].enabled = TRUE;
-  }
-  return(0);
-}
-
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
-void s_color_destroy_all(void)
-{
-  /* Don't do anything, for now */
-}
-
-/*! \todo Finish function documentation!!!
- *  \brief
- *  \par Function Description
- *
- */
 gchar *s_color_ps_string(gint color)
 {
   COLOR c;

commit 06449db86b91db91bf5d4551acc2794cf34c97f1
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:29:47 2008 +0000

    New Scheme colormap syntax.
    
    Add new color map functions for setting multiple colors at a time with
    a simple list-based structure. Use one per color map rather than one
    per color.
    
    Use a wrapper macro in Scheme to make it easier to construct Scheme
    color map structures by using symbols instead of indexes to specify
    map entries.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index aa58252..5296f2e 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -289,6 +289,8 @@ SCM g_rc_print_command(SCM mode);
 SCM g_rc_select_slack_pixels(SCM pixels);
 SCM g_rc_zoom_gain(SCM gain);
 SCM g_rc_scrollpan_steps(SCM steps);
+SCM g_rc_display_color_map (SCM scm_map);
+SCM g_rc_display_outline_color_map (SCM scm_map);
 /* g_register.c */
 void g_register_funcs(void);
 /* globals.c */
diff --git a/gschem/lib/gschem-darkbg b/gschem/lib/gschem-darkbg
index 28e1e82..5496c16 100644
--- a/gschem/lib/gschem-darkbg
+++ b/gschem/lib/gschem-darkbg
@@ -1,219 +1,90 @@
-
-; 
-; Dark background color init file for gschem
+;                                                         -*-Scheme-*-
+;
+; Dark background color map for gschem
 ;
 
 ;  ;'s are comments
-;  keywords are case sensitive (guile feature)
-;  mode strings are case sensitive
-;  colors are not case sensitive 
-;  
-
-;
-; Start of color related keywords
+;  Keywords are case sensitive (Guile feature)
+;  Colors are not case sensitive
 ;
 
-;
-; Color index reference
-;
-; Colors may be specified in #RRGGBB or #RRGGBBAA format. If the alpha
+; Colors may be specified in "#RRGGBB" or "#RRGGBBAA" format. If the alpha
 ; value is not specified, full opacity is assumed.
-; DO NOT change the index value of these colors, unless you understand what
-; you are changing.
-
-; BACKGROUND_COLOR                0
-; PIN_COLOR                       1
-; NET_ENDPOINT_COLOR              2
-; GRAPHIC_COLOR                   3
-; NET_COLOR                       4
-; ATTRIBUTE_COLOR                 5
-; LOGIC_BUBBLE_COLOR              6
-; GRID_COLOR                      7
-; DETACHED_ATTRIBUTE_COLOR        8
-; TEXT_COLOR                      9
-; BUS_COLOR                       10
-; SELECT_COLOR                    11
-; BOUNDINGBOX_COLOR               12
-; ZOOM_BOX_COLOR                  13
-; STROKE_COLOR                    14
-; LOCK_COLOR    	          15
-; OUTPUT_BACKGROUND_COLOR         16
-; Freestyle colors		  17-20
-; JUNCTION_COLOR                  21
-;
-; OVERRIDE_NET_COLOR              4
-; OVERRIDE_PIN_COLOR              1
-; OVERRIDE_BUS_COLOR              10
-
-;
-; In all of the color modes: 
-; 	the first string is the actual color name
-;	the second string is the outline color name 
-; 	the third string is the postscript color name
-;
-
-
-
-; background-color index display_color outline_color print_color 
-; Set the default background color.  
-; DO NOT change the value of the index (first number)
 ;
-(background-color 0 "#000000" "#ffffff00" "#ffffff00")  	; dark background
-
-; pin-color index display_color outline_color print_color 
-; Set the color of any new pins (does not effect existing pins).
-; To change existing pins use the override-pin-color
-; DO NOT change the value of the index (first number)
-;
-(pin-color 1 "#ffffff" "#bebebe" "#ffffff") 	; dark background
-
-; net-endpoint-color index display_color outline_color print_color 
-; Set the default net endpoint color.  
-; DO NOT change the value of the index (first number)
-;
-(net-endpoint-color 2 "#ff0000" "#00cd00" "#ff0000")	; dark background	
-
-; graphic-color index display_color outline_color print_color 
-; Set the default graphics color.  All new Lines, Boxes, Circles, and Arcs 
-; are effected by this keyword.  Existing graphic objects are not effected 
-; by this keyword.  
-; DO NOT change the value of the index (first number)
-; 
-(graphic-color 3 "#00ff00" "#00cd00" "#00ff00")	; dark background
-
-; net-color index display_color outline_color print_color 
-; Set the color of any new nets (does not effect existing nets).
-; To change existing nets use the override-net-color 
-; DO NOT change the value of the index (first number)
-;
-(net-color 4 "#0000ff" "#0000cd" "#0000ff")		; dark background
-
-; attribute-color index display_color outline_color print_color 
-; Set the color of attributes.  Attributes are any object associated with 
-; another with the 'Attach Attribute' command.  
-; DO NOT change the value of the index (first number)
-;
-(attribute-color 5 "#ffff00" "#cdcd00" "#ffff00") ; dark background
-
-; logic-bubble-color index display_color outline_color print_color 
-; Set the color of logic bubbles / circles.  
-; DO NOT change the value of the index (first number)
-;
-; light background  
-(logic-bubble-color 6 "#00ffff" "#00cdcd" "#00ffff") ; dark background
-
-; grid-color index display_color outline_color print_color 
-; Set the default grid color.  
-; DO NOT change the value of the index (first number)
-;
-(grid-color 7 "#bebebe" "#ffffff00" "#ffffff00")		; dark background
-
-; detached-attribute-color index display_color outline_color print_color 
-; Set the color of detached attributes.  Detached attributes are just 
-; text items which were attributes at one time.  Detached attributes 
-; are created in conjunction with the 'Detach Attribute' command.  
-; DO NOT change the value of the index (first number)
-;
-(detached-attribute-color 8 "#ff0000" "#cd0000" "#ff0000")  ; dark background
-
-; text-color index display_color outline_color print_color 
-; Set the color of any new text (does not effect attributes, see below).
-; Existing graphic objects are not effected by this keyword.  
-; DO NOT change the value of the index (first number)
-;
-(text-color 9 "#00ff00" "#00cd00" "#00ff00")	    ; dark background
-
-; bus-color index display_color outline_color print_color 
-; Set the color of any new buses (does not effect existing buses).
-; To change existing buses use the override-bus-color 
-; DO NOT change the value of the index (first number)
-;
-(bus-color 10 "#00ff00" "#00cd00" "#00ff00")	    ; dark background
-
-; select-color index display_color outline_color print_color 
-; Set the default selection color.  This include the bounding box in window
-; selects and when objects are selected.  
-; DO NOT change the value of the index (first number)
-;
-(select-color 11 "#ffa500" "#ffa500" "#ffffff00")	    ; dark background
-
-; boundingbox-color index display_color outline_color print_color 
-; Set the default bounding box color.  The bounding box color is displayed 
-; whenever you request that actions (move/copy/place) use a bounding box 
-; instead of the default outline.  
-; DO NOT change the value of the index (first number)
-; 
-(boundingbox-color 12 "#ffa500" "#ffa500" "#ffffff00")   ; dark background
-
-; zoom-box-color index display_color outline_color print_color 
-; Set the default zoom box color.  The zoom box color is displayed 
-; whenever you use the zoom window / box option. 
-; DO NOT change the value of the index (first number)
-; 
-(zoom-box-color 13 "#00ffff" "#00ffff" "#ffffff00")	     ; dark background
-
-; stroke-color index display_color outline_color print_color 
-; Set the default stroke color which is displayed when you draw a stroke.
-; Basically this color specifies what the mouse droppings color
-; DO NOT change the value of the index (first number)
-;
-(stroke-color 14 "#e5e5e5" "#e5e5e5" "#ffffff00")	     ; dark background
-
-; lock-color index display_color outline_color print_color 
-; Set the default lock color which is used when you lock an object down
-; DO NOT change the value of the index (first number)
-;
-(lock-color 15 "#bebebe" "#a9a9a9" "#bebebe") ; dark background
-
-; output-color-background index display_color outline_color print_color 
-; Specifies the color of the background of the output (color postscript file)
-; 	- string is one of the valid colors
-; 	- Only used if ouput-color is "enabled" (see above)
-; DO NOT change the value of the index (first number)
-;
-(output-color-background 16 "#000000" "#ffffff00" "#000000")    ; dark background
-
-; override-net-color index display_color outline_color print_color 
-; Override the color of ALL nets
-; New net color will be applied to all nets in any file which is opened and
-; then saved. Comment out if you don't want to override the net color.
-; DO NOT change the value of the index (first number)
-; 
-;(override-net-color 4 "#0000ff" "#0000cd" "#0000ff")
-
-; override-pin-color index display_color outline_color print_color 
-; Override the color of ALL pins
-; New pin color will be applied to all pin in any file which is opened and
-; then saved.  Comment out if you don't want to override the pin color.
-; DO NOT change the value of the index (first number)
-;
-;(override-pin-color 1 "#ffffff" "#bebebe" "#ffffff")
-
-; override-bus-color index display_color outline_color print_color 
-; Override the color of ALL buses
-; New net color will be applied to all buses in any file which is opened and
-; then saved. Comment out if you don't want to override the bus color.
-; DO NOT change the value of the index (first number)
-; 
-;(override-bus-color 10 "#00ff00" "#00cd00" "#00ff00")
-
-; freestyle-color index display_color outline_color print_color 
-; Set a freestyle color which can be used in whatever context you want.
-; However, care should be taken with this facility since users might 
-; change this colors at will.
-;
-;(freestyle-color 17 "#abcdef" "#abcdef" "#abcdef")
-;(freestyle-color 18 "#abcdef" "#abcdef" "#abcdef")
-;(freestyle-color 19 "#abcdef" "#abcdef" "#abcdef")
-;(freestyle-color 20 "#abcdef" "#abcdef" "#abcdef")
-
-; junction-color index display_color outline_color print_color 
-; Set the default junction color.  
-; DO NOT change the value of the index (first number)
-;
-(junction-color 21 "#ffff00" "#cdcd00" "#ffff00")   ; dark background	
-
-;
-; End of color related keywords
-;
-
+; If a color is #f (not a string; Scheme 'false'), then objects of
+; that color will never be drawn.
+
+(display-color-map
+ '((background         "#000000")
+   (pin                "#ffffff")
+   (net-endpoint       "#ff0000")
+   (graphic            "#00ff00")
+   (net                "#0000ff")
+   (attribute          "#ffff00")
+   (logic-bubble       "#00ffff")
+   (grid               "#bebebe")
+   (detached-attribute "#ff0000")
+   (text               "#00ff00")
+   (bus                "#00ff00")
+   (select             "#ffa500")
+   (bounding-box       "#ffa500")
+   (zoom-box           "#00ffff")
+   (stroke             "#e5e5e5")
+   (lock               "#bebebe")
+   (output-background  #f)
+   (junction           "#ffff00")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
+
+(display-outline-color-map
+ '((background         #f)
+   (pin                "#bebebe")
+   (net-endpoint       "#00cd00")
+   (graphic            "#00cd00")
+   (net                "#0000cd")
+   (attribute          "#cdcd00")
+   (logic-bubble       "#00cdcd")
+   (grid               #f)
+   (detached-attribute "#cd0000")
+   (text               "#00cd00")
+   (bus                "#00cd00")
+   (select             "#ffa500")
+   (bounding-box       "#ffa500")
+   (zoom-box           "#00ffff")
+   (stroke             "#e5e5e5")
+   (lock               "#a9a9a9")
+   (output-background  #f)
+   (junction           "#cdcd00")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
+
+(print-color-map
+ '((background         #f)
+   (pin                "#ffffff")
+   (net-endpoint       "#ff0000")
+   (graphic            "#00ff00")
+   (net                "#0000ff")
+   (attribute          "#ffff00")
+   (logic-bubble       "#00ffff")
+   (grid               #f)
+   (detached-attribute "#ff0000")
+   (text               "#00ff00")
+   (bus                "#00ff00")
+   (select             #f)
+   (bounding-box       #f)
+   (zoom-box           #f)
+   (stroke             #f)
+   (lock               #f)
+   (output-background  "#000000")
+   (junction           "#ffff00")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
diff --git a/gschem/lib/gschem-lightbg b/gschem/lib/gschem-lightbg
index c856a09..dd42dbf 100644
--- a/gschem/lib/gschem-lightbg
+++ b/gschem/lib/gschem-lightbg
@@ -1,220 +1,90 @@
-
-; 
-; Light background color init file for gschem
+;                                                         -*-Scheme-*-
+;
+; Light background color map for gschem
 ;
 
 ;  ;'s are comments
-;  keywords are case sensitive (guile feature)
-;  mode strings are case sensitive
-;  colors are not case sensitive 
-;  
-
-;
-; Start of color related keywords
+;  Keywords are case sensitive (guile feature)
+;  Colors are not case sensitive
 ;
 
-;
-; Color index reference
-;
-; Colors may be specified in #RRGGBB or #RRGGBBAA format. If the alpha
+; Colors may be specified in "#RRGGBB" or "#RRGGBBAA" format. If the alpha
 ; value is not specified, full opacity is assumed.
-; DO NOT change the index value of these colors, unless you understand what
-; you are changing.
-
-; BACKGROUND_COLOR                0
-; PIN_COLOR                       1
-; NET_ENDPOINT_COLOR              2
-; GRAPHIC_COLOR                   3
-; NET_COLOR                       4
-; ATTRIBUTE_COLOR                 5
-; LOGIC_BUBBLE_COLOR              6
-; GRID_COLOR                      7
-; DETACHED_ATTRIBUTE_COLOR        8
-; TEXT_COLOR                      9
-; BUS_COLOR                       10
-; SELECT_COLOR                    11
-; BOUNDINGBOX_COLOR               12
-; ZOOM_BOX_COLOR                  13
-; STROKE_COLOR                    14
-; LOCK_COLOR    	          15
-; OUTPUT_BACKGROUND_COLOR         16
-; Freestyle colors		  17-20
-; JUNCTION_COLOR                  21
-;
-; OVERRIDE_NET_COLOR              4
-; OVERRIDE_PIN_COLOR              1
-; OVERRIDE_BUS_COLOR              10
-
-;
-; In all of the color modes: 
-; 	the first string is the display color value
-;	the second string is the outline color value 
-; 	the third string is the postscript color value
-;
-
-
-
-; background-color index display_color outline_color print_color 
-; Set the default background color.  
-; DO NOT change the value of the index (first number)
-;
-(background-color 0 "#f0f0f0" "#ffffff00" "#ffffff") ; light background
-
-; pin-color index display_color outline_color print_color 
-; Set the color of any new pins (does not effect existing pins).
-; To change existing pins use the override-pin-color
-; DO NOT change the value of the index (first number)
-;
-(pin-color 1 "#000000" "#4d4d4d" "#000000")		; light background
-
-; net-endpoint-color index display_color outline_color print_color 
-; Set the default net endpoint color.  
-; DO NOT change the value of the index (first number)
-;
-(net-endpoint-color 2 "#ff0000" "#cdcdcd" "#ff0000")	; light background
-
-; graphic-color index display_color outline_color print_color 
-; Set the default graphics color.  All new Lines, Boxes, Circles, and Arcs 
-; are effected by this keyword.  Existing graphic objects are not effected 
-; by this keyword.  
-; DO NOT change the value of the index (first number)
-; 
-(graphic-color 3 "#008b00" "#008b00" "#008b00")	; light background
-
-; net-color index display_color outline_color print_color 
-; Set the color of any new nets (does not effect existing nets).
-; To change existing nets use the override-net-color 
-; DO NOT change the value of the index (first number)
-;
-(net-color 4 "#00008b" "#0000cd" "#0000ff")		; light background
-
-; attribute-color index display_color outline_color print_color 
-; Set the color of attributes.  Attributes are any object associated with 
-; another with the 'Attach Attribute' command.  
-; DO NOT change the value of the index (first number)
-;
-(attribute-color 5 "#000000" "#4d4d4d" "#000000")	  ; light background
-
-; logic-bubble-color index display_color outline_color print_color 
-; Set the color of logic bubbles / circles.  
-; DO NOT change the value of the index (first number)
-;
-(logic-bubble-color 6 "#008b8b" "#008b8b" "#008b8b") ; light bg  
-
-; grid-color index display_color outline_color print_color 
-; Set the default grid color.  
-; DO NOT change the value of the index (first number)
-;
-(grid-color 7 "#7f7f7f" "#ffffff00" "#ffffff00")		; light background
-
-; detached-attribute-color index display_color outline_color print_color 
-; Set the color of detached attributes.  Detached attributes are just 
-; text items which were attributes at one time.  Detached attributes 
-; are created in conjunction with the 'Detach Attribute' command.  
-; DO NOT change the value of the index (first number)
-;
-(detached-attribute-color 8 "#ff0000" "#cd0000" "#ff0000")   ; light background
-
-; text-color index display_color outline_color print_color 
-; Set the color of any new text (does not effect attributes, see below).
-; Existing graphic objects are not effected by this keyword.  
-; DO NOT change the value of the index (first number)
-;
-(text-color 9 "#008b00" "#008b00" "#008b00")	    ; light background
-
-; bus-color index display_color outline_color print_color 
-; Set the color of any new buses (does not effect existing buses).
-; To change existing buses use the override-bus-color 
-; DO NOT change the value of the index (first number)
-;
-(bus-color 10 "#00ee00" "#00cd00" "#00ee00")	    ; light background
-
-; select-color index display_color outline_color print_color 
-; Set the default selection color.  This include the bounding box in window
-; selects and when objects are selected.  
-; DO NOT change the value of the index (first number)
-;
-(select-color 11 "#b22222" "#b22222" "#ffffff00")   ; light background
-
-; boundingbox-color index display_color outline_color print_color 
-
-; Set the default bounding box color.  The bounding box color is displayed 
-; whenever you request that actions (move/copy/place) use a bounding box 
-; instead of the default outline.  
-; DO NOT change the value of the index (first number)
-; 
-(boundingbox-color 12 "#ffa500" "#ffa500" "#ffffff00")    ; light background
-
-; zoom-box-color index display_color outline_color print_color 
-; Set the default zoom box color.  The zoom box color is displayed 
-; whenever you use the zoom window / box option. 
-; DO NOT change the value of the index (first number)
-; 
-(zoom-box-color 13 "#008b8b" "#008b8b" "#ffffff00")    ; light background
-
-; stroke-color index display_color outline_color print_color 
-; Set the default stroke color which is displayed when you draw a stroke.
-; Basically this color specifies what the mouse droppings color
-; DO NOT change the value of the index (first number)
-;
-(stroke-color 14 "#a020f0" "#a020f0" "#ffffff00")	     ; light background
-
-; lock-color index display_color outline_color print_color 
-; Set the default lock color which is used when you lock an object down
-; DO NOT change the value of the index (first number)
 ;
-(lock-color 15 "#666666" "#a9a9a9" "#666666")   ; light background
-
-; output-color-background index display_color outline_color print_color 
-; Specifies the color of the background of the output (color postscript file)
-; 	- string is one of the valid colors
-; 	- Only used if ouput-color is "enabled" (see above)
-; DO NOT change the value of the index (first number)
-;
-(output-color-background 16 "#ffffff" "#ffffff" "#ffffff") ; light back
-
-; override-net-color index display_color outline_color print_color 
-; Override the color of ALL nets
-; New net color will be applied to all nets in any file which is opened and
-; then saved. Comment out if you don't want to override the net color.
-; DO NOT change the value of the index (first number)
-; 
-;(override-net-color 4 "#0000ff" "#0000cd" "#0000ff")
-
-; override-pin-color index display_color outline_color print_color 
-; Override the color of ALL pins
-; New pin color will be applied to all pin in any file which is opened and
-; then saved.  Comment out if you don't want to override the pin color.
-; DO NOT change the value of the index (first number)
-;
-;(override-pin-color 1 "#ffffff" "#bebebe" "#ffffff")
-
-; override-bus-color index display_color outline_color print_color 
-; Override the color of ALL buses
-; New net color will be applied to all buses in any file which is opened and
-; then saved. Comment out if you don't want to override the bus color.
-; DO NOT change the value of the index (first number)
-; 
-;(override-bus-color 10 "#00ff00" "#00cd00" "#00ff00")
-
-; freestyle-color index display_color outline_color print_color 
-; Set a freestyle color which can be used in whatever context you want.
-; However, care should be taken with this facility since users might 
-; change this colors at will.
-;
-;(freestyle-color 17 "#abcdef" "#abcdef" "#abcdef")
-;(freestyle-color 18 "#abcdef" "#abcdef" "#abcdef")
-;(freestyle-color 19 "#abcdef" "#abcdef" "#abcdef")
-;(freestyle-color 20 "#abcdef" "#abcdef" "#abcdef")
-
-; junction-color index display_color outline_color print_color 
-; Set the default junction color.  
-; DO NOT change the value of the index (first number)
-;
-(junction-color 21 "#a020f0" "#7e26cd" "#a020f0") 
-; light background
-
-;
-; End of color related keywords
-;
-
+; If a color is #f (not a string; Scheme 'false'), then objects of
+; that color will never be drawn.
+
+(display-color-map
+ '((background         "#f0f0f0")
+   (pin                "#000000")
+   (net-endpoint       "#ff0000")
+   (graphic            "#008b00")
+   (net                "#00008b")
+   (attribute          "#000000")
+   (logic-bubble       "#008b8b")
+   (grid               "#7f7f7f")
+   (detached-attribute "#ff0000")
+   (text               "#008b00")
+   (bus                "#00ee00")
+   (select             "#b22222")
+   (bounding-box       "#ffa500")
+   (stroke             "#a020f0")
+   (zoom-box           "#008b8b")
+   (lock               "#666666")
+   (output-background  #f)
+   (junction           "#a020f0")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
+
+(display-outline-color-map
+ '((background         #f)
+   (pin                "#4d4d4d")
+   (net-endpoint       "#cdcdcd")
+   (graphic            "#008b00")
+   (net                "#0000cd")
+   (attribute          "#4d4d4d")
+   (logic-bubble       "#008b8b")
+   (grid               #f)
+   (detached-attribute "#cd0000")
+   (text               "#008b00")
+   (bus                "#00cd00")
+   (select             "#b22222")
+   (bounding-box       "#ffa500")
+   (zoom-box           "#008b8b")
+   (stroke             "#a020f0")
+   (lock               "#a9a9a9")
+   (output-background  #f)
+   (junction           "#7e26cd")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
+
+(print-color-map
+ '((background         "#ffffff")
+   (pin                "#000000")
+   (net-endpoint       "#ff0000")
+   (graphic            "#008b00")
+   (net                "#0000ff")
+   (attribute          "#000000")
+   (logic-bubble       "#008b8b")
+   (grid               #f)
+   (detached-attribute "#ff0000")
+   (text               "#008b00")
+   (bus                "#00ee00")
+   (select             #f)
+   (bounding-box       #f)
+   (zoom-box           #f)
+   (stroke             #f)
+   (lock               "#666666")
+   (output-background  "#ffffff")
+   (junction           "#a020f0")
+   (freestyle1         #f)
+   (freestyle2         #f)
+   (freestyle3         #f)
+   (freestyle4         #f)
+   ))
diff --git a/gschem/lib/system-gschemrc.in b/gschem/lib/system-gschemrc.in
index 8aea9ae..07a7958 100644
--- a/gschem/lib/system-gschemrc.in
+++ b/gschem/lib/system-gschemrc.in
@@ -20,6 +20,11 @@
 ;
 ; Start of color section 
 ;
+
+;; Make the gschem color maps more user-friendly
+(color-map-make-friendly display-color-map)
+(color-map-make-friendly display-outline-color-map)
+
 ; Load up a color scheme has a light (almost white) background
 ; Comment out the first line and comment in the second line for a
 ; dark (black) background.  The dark background is the original look. 
diff --git a/gschem/src/g_rc.c b/gschem/src/g_rc.c
index d390569..7fa38f2 100644
--- a/gschem/src/g_rc.c
+++ b/gschem/src/g_rc.c
@@ -1724,3 +1724,33 @@ SCM g_rc_scrollpan_steps(SCM steps)
 
   return SCM_BOOL_T;
 }
+
+
+extern COLOR display_colors[MAX_COLORS];
+extern COLOR display_outline_colors[MAX_COLORS];
+
+SCM g_rc_display_color_map (SCM scm_map)
+{
+  if (scm_map == SCM_UNDEFINED) {
+    return s_color_map_to_scm (display_colors);
+  }
+
+  SCM_ASSERT (scm_is_true (scm_list_p (scm_map)),
+              scm_map, SCM_ARG1, "display-color-map");
+
+  s_color_map_from_scm (display_colors, scm_map, "display-color-map");
+  return SCM_BOOL_T;
+}
+
+SCM g_rc_display_outline_color_map (SCM scm_map)
+{
+  if (scm_map == SCM_UNDEFINED) {
+    return s_color_map_to_scm (display_outline_colors);
+  }
+
+  SCM_ASSERT (scm_is_true (scm_list_p (scm_map)),
+              scm_map, SCM_ARG1, "display-outline-color-map");
+
+  s_color_map_from_scm (display_outline_colors, scm_map, "display-outline-color-map");
+  return SCM_BOOL_T;
+}
diff --git a/gschem/src/g_register.c b/gschem/src/g_register.c
index a6e4800..059d896 100644
--- a/gschem/src/g_register.c
+++ b/gschem/src/g_register.c
@@ -74,6 +74,9 @@ static struct gsubr_t gschem_funcs[] = {
   { "output-color-background",  4, 0, 0, g_rc_output_color_background },
   { "freestyle-color",          4, 0, 0, g_rc_freestyle_color },
 
+  { "display-color-map",        0, 1, 0, g_rc_display_color_map },
+  { "display-outline-color-map", 0, 1, 0, g_rc_display_outline_color_map },
+
   { "net-endpoint-mode",         1, 0, 0, g_rc_net_endpoint_mode },
   { "net-midpoint-mode",         1, 0, 0, g_rc_net_midpoint_mode },
   { "net-direction-mode",        1, 0, 0, g_rc_net_direction_mode },
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index bb295e4..ad39385 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -357,6 +357,8 @@ gboolean s_color_rgba_decode (const gchar *rgba,
 gchar *s_color_rgba_encode (guint8 r, guint8 g, guint8 b, guint8 a);
 int s_color_request(int color_index, char *color_string, char *outline_color_string, char *ps_color_string);
 void s_color_destroy_all(void);
+SCM s_color_map_to_scm (const COLOR *map);
+void s_color_map_from_scm (COLOR *map, SCM lst, const char *scheme_proc_name);
 
 /* s_conn.c */
 CONN *s_conn_return_new(OBJECT *other_object, int type, int x, int y, int whichone, int other_whichone);
diff --git a/libgeda/include/prototype_priv.h b/libgeda/include/prototype_priv.h
index 2b53236..8befc83 100644
--- a/libgeda/include/prototype_priv.h
+++ b/libgeda/include/prototype_priv.h
@@ -32,6 +32,7 @@ SCM g_rc_attribute_promotion(SCM mode);
 SCM g_rc_promote_invisible(SCM mode);
 SCM g_rc_keep_invisible(SCM mode);
 SCM g_rc_always_promote_attributes(SCM scmsymname);
+SCM g_rc_print_color_map (SCM scm_map);
 
 /* g_register.c */
 void g_register_libgeda_funcs(void);
diff --git a/libgeda/lib/system-gafrc b/libgeda/lib/system-gafrc
index f7d5a50..91d124a 100644
--- a/libgeda/lib/system-gafrc
+++ b/libgeda/lib/system-gafrc
@@ -97,3 +97,9 @@
 ;
 ; End of attribute promotion keywords
 ; 
+
+;; Load functions for handling color maps
+(load-from-path "color-map.scm")
+
+;; Make the printing color map more user-friendly
+(color-map-make-friendly print-color-map)
diff --git a/libgeda/scheme/Makefile.am b/libgeda/scheme/Makefile.am
index 5f8d7b1..d51e79f 100644
--- a/libgeda/scheme/Makefile.am
+++ b/libgeda/scheme/Makefile.am
@@ -1,6 +1,6 @@
 
 scmdatadir = @GEDADATADIR@/scheme
-dist_scmdata_DATA = geda.scm
+dist_scmdata_DATA = geda.scm color-map.scm
 
 MOSTLYCLEANFILES = *.log *~
 CLEANFILES = *.log *~
diff --git a/libgeda/scheme/color-map.scm b/libgeda/scheme/color-map.scm
new file mode 100644
index 0000000..41dd8db
--- /dev/null
+++ b/libgeda/scheme/color-map.scm
@@ -0,0 +1,74 @@
+;                                                         -*-Scheme-*-
+
+;; Map between color index numbers and symbolic color names
+(define %color-name-map
+  '((background . 0)
+    (pin . 1)
+    (net-endpoint . 2)
+    (graphic . 3)
+    (net . 4)
+    (attribute . 5)
+    (logic-bubble . 6)
+    (grid . 7)
+    (detached-attribute . 8)
+    (text . 9)
+    (bus . 10)
+    (select . 11)
+    (bounding-box . 12)
+    (zoom-box . 13)
+    (stroke . 14)
+    (lock . 15)
+    (output-background . 16)
+    (junction . 21)
+
+    (freestyle1 . 17)
+    (freestyle2 . 18)
+    (freestyle3 . 19)
+    (freestyle4 . 20)))
+
+;; Look up the internal system ID for a symbolic color
+(define (color-map-name-to-index val)
+  (if (symbol? val)
+      (apply + (map (lambda (x)
+                      (if (eqv? (car x) val) (cdr x) 0))
+                    %color-name-map))
+      val))
+
+
+;; Look up the symbolic color for an internal system ID
+(define (color-map-name-from-index idx)
+  (define (impl lst idx)
+    (if (null? lst)
+        idx ;; Fall back to the index if no symbol found
+        (let ((entry (car lst)))
+          (if (eq? idx (cdr entry))
+              (car entry)
+              (impl (cdr lst) idx)))))
+  (impl %color-name-map idx))
+
+;; Convert a color map to use system IDs
+(define (color-map-to-symbolic colormap)
+  (map (lambda (entry)
+         (list (color-map-name-from-index (car entry))
+               (cadr entry)))
+       colormap))
+
+;; Convert a color map to use symbolic color names
+(define (color-map-from-symbolic colormap)
+  (map (lambda (entry)
+         (list (color-map-name-to-index (car entry))
+               (cadr entry)))
+       colormap))
+
+;; Given a color map function (e.g. print-color-map), return an
+;; equivalent function that uses symbolic colors.
+(define (color-map-friendlier-function map-function)
+  (lambda rest
+    (if (null? rest)
+        (color-map-to-symbolic (map-function))
+        (map-function (apply color-map-from-symbolic rest)))))
+
+;; Converts a standard color map function into one which understands
+;; symbolic colors
+(define-macro (color-map-make-friendly func)
+  `(define ,func (color-map-friendlier-function ,func)))
diff --git a/libgeda/src/g_rc.c b/libgeda/src/g_rc.c
index a9da66d..793ae31 100644
--- a/libgeda/src/g_rc.c
+++ b/libgeda/src/g_rc.c
@@ -1060,3 +1060,18 @@ SCM g_rc_always_promote_attributes(SCM attrlist)
 
   return SCM_BOOL_T;
 }
+
+extern COLOR print_colors[MAX_COLORS];
+
+SCM g_rc_print_color_map (SCM scm_map)
+{
+  if (scm_map == SCM_UNDEFINED) {
+    return s_color_map_to_scm (print_colors);
+  }
+
+  SCM_ASSERT (scm_is_true (scm_list_p (scm_map)),
+              scm_map, SCM_ARG1, "print-color-map");
+
+  s_color_map_from_scm (print_colors, scm_map, "print-color-map");
+  return SCM_BOOL_T;
+}
diff --git a/libgeda/src/g_register.c b/libgeda/src/g_register.c
index b78b97b..c254765 100644
--- a/libgeda/src/g_register.c
+++ b/libgeda/src/g_register.c
@@ -72,6 +72,7 @@ static struct gsubr_t libgeda_funcs[] = {
   { "promote-invisible",         1, 0, 0, g_rc_promote_invisible },
   { "keep-invisible",            1, 0, 0, g_rc_keep_invisible },
   { "always-promote-attributes",1, 0, 0, g_rc_always_promote_attributes },
+  { "print-color-map", 0, 1, 0, g_rc_print_color_map },
   { NULL,                       0, 0, 0, NULL } };
 
 /*! \brief Register all libgeda functions with scheme.
diff --git a/libgeda/src/s_color.c b/libgeda/src/s_color.c
index 6e47437..2f052eb 100644
--- a/libgeda/src/s_color.c
+++ b/libgeda/src/s_color.c
@@ -57,7 +57,6 @@ void s_color_init(void)
     display_colors[i] = black;
     display_outline_colors[i] = black;
   }
-
 }
 
 /* \brief Decode a hexadecimal RGB or RGBA color code.
@@ -237,3 +236,98 @@ gchar *s_color_ps_string(gint color)
                             (gdouble) c.b/255.0);
   }
 }
+
+SCM
+s_color_map_to_scm (const COLOR *map)
+{
+  SCM result = SCM_EOL;
+  int i;
+  for (i = MAX_COLORS - 1; i >= 0; i--) {
+    SCM color_val = SCM_BOOL_F;
+    if (map[i].enabled) {
+      COLOR c = map[i];
+      gchar *rgba = s_color_rgba_encode (c.r, c.g, c.b, c.a);
+      color_val = scm_from_locale_string (rgba);
+      g_free (rgba);
+    }
+    result = scm_cons (scm_list_2 (scm_from_int (i), color_val), result);
+  }
+  return result;
+}
+
+/*!
+ * \warning This function should ONLY be called from Scheme procedures.
+ */
+void
+s_color_map_from_scm (COLOR *map, SCM lst, const char *scheme_proc_name)
+{
+  SCM curr = lst;
+  SCM wrong_type_arg_sym = scm_from_locale_symbol ("wrong-type-arg");
+  SCM proc_name = scm_from_locale_string (scheme_proc_name);
+  while (!scm_is_null (curr)) {
+    int i;
+    char *rgba;
+    SCM s;
+    COLOR c;
+    gboolean result;
+    SCM entry = scm_car (curr);
+
+    /* Check map entry has correct type */
+    if (!scm_is_true (scm_list_p (entry))
+        || (scm_to_int (scm_length (entry)) != 2)) {
+      scm_error_scm (wrong_type_arg_sym, proc_name,
+                     scm_from_locale_string (_("Color map entry must be a two-element list")),
+                     SCM_EOL, scm_list_1 (entry));
+    }
+
+    /* Check color index has correct type, and extract it */
+    s = scm_car (entry);
+    if (!scm_is_integer (s)) {
+      scm_error_scm (wrong_type_arg_sym, proc_name,
+                     scm_from_locale_string (_("Index in color map entry must be an integer")),
+                     SCM_EOL, scm_list_1 (s));
+    }
+    i = scm_to_int (s);
+
+    /* Check color index is within bounds. If it's out of bounds, it's
+     * legal, but warn & ignore it.
+     *
+     * FIXME one day we will have dynamically-expanding colorspace.
+     * One day. */
+    if ((i < 0) || (i >= MAX_COLORS)) {
+      g_critical ("Color map index out of bounds: %i\n", i);
+      goto color_map_next;
+    }
+
+    /* If color value is #F, disable color */
+    s = scm_cadr (entry);
+    if (scm_is_false (s)) {
+      map[i].enabled = FALSE;
+      goto color_map_next;
+    }
+
+    /* Otherwise, we require a string */
+    s = scm_cadr (entry);
+    if (!scm_is_string (s)) {
+      scm_error_scm (wrong_type_arg_sym, proc_name,
+                     scm_from_locale_string (_("Value in color map entry must be #f or a string")),
+                     SCM_EOL, scm_list_1 (s));
+    }
+    rgba = scm_to_locale_string (s);
+
+    result = s_color_rgba_decode (rgba, &c.r, &c.g, &c.b, &c.a);
+
+    /* FIXME should we generate a Guile error if there's a problem here? */
+    if (!result) {
+      g_critical ("Invalid color map value: %s\n", rgba);
+    } else {
+      map[i] = c;
+      map[i].enabled = TRUE;
+    }
+
+  color_map_next:
+    /* Go to next element in map */
+    curr = scm_cdr (curr);
+  }
+  scm_remember_upto_here_2 (wrong_type_arg_sym, proc_name);
+}

commit af4756b843d6da32b8355a50bf3bb1f2bee0a539
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:20:17 2008 +0000

    Store colors as components rather than as strings.
    
    Rather than storing colors in libgeda as strings or GdkColor
    structures, store them as a set of four 8-bit unsigned integers.
    
    Since the GdkColor structure is renderer-specific, remove all trace of
    it from libgeda -- only gschem needs to know about it.

diff --git a/gschem/src/x_color.c b/gschem/src/x_color.c
index f837e7b..f9f4ab1 100644
--- a/gschem/src/x_color.c
+++ b/gschem/src/x_color.c
@@ -31,7 +31,11 @@
 #include <dmalloc.h>
 #endif
 
-extern COLOR colors[MAX_COLORS];
+extern COLOR display_colors[MAX_COLORS];
+extern COLOR display_outline_colors[MAX_COLORS];
+
+static GdkColor* gdk_colors[MAX_COLORS];
+static GdkColor* gdk_outline_colors[MAX_COLORS];
 
 static void x_color_allocate_all(void);
 
@@ -89,82 +93,64 @@ static void x_color_allocate_all(void)
 {
   int error;
   int i;		
-  guint8 r, g, b, a;
+  COLOR c;
 
   for (i = 0; i < MAX_COLORS; i++) {
-    if (!colors[i].enabled) continue;
-    if (colors[i].color_name) {
-      error = s_color_rgba_decode (colors[i].color_name,
-                                   &r, &g, &b, &a);
-      if (!error) {
-        g_warning (_("Could not decode color: \"%s\". "
-                     "Defaulting to white.\n"),
-                   colors[i].color_name);
-      }
 
-      colors[i].gdk_color = (GdkColor *)
+    if (display_colors[i].enabled) {
+      gdk_colors[i] = (GdkColor *)
         g_malloc(sizeof(GdkColor));
 
+      c = display_colors[i];
+
       /* Interpolate 8-bpp colours into 16-bpp GDK color
        * space. N.b. ignore transparency because GDK doesn't
        * understand it. */
-      colors[i].gdk_color->red = r + (r<<8);
-      colors[i].gdk_color->green = g + (g<<8);
-      colors[i].gdk_color->blue = b + (b<<8);
+      gdk_colors[i]->red = c.r + (c.r<<8);
+      gdk_colors[i]->green = c.g + (c.g<<8);
+      gdk_colors[i]->blue = c.b + (c.b<<8);
 
-      error = gdk_color_alloc(colormap, colors[i].gdk_color);
+      error = gdk_color_alloc(colormap, gdk_colors[i]);
 
       if (error == FALSE) {
         g_error (_("Could not allocate display color %i!\n"), i);
       }
-
+    } else {
+      gdk_colors[i] = NULL;
     }
-  }
-
-  for (i = 0; i < MAX_COLORS; i++) {
-    if (colors[i].outline_color_name) {
-      error = s_color_rgba_decode (colors[i].outline_color_name,
-                                   &r, &g, &b, &a);
-      if (!error) {
-        g_warning (_("Could not decode color: \"%s\". "
-                     "Defaulting to white.\n"),
-                   colors[i].outline_color_name);
-      }
 
-      colors[i].gdk_outline_color = (GdkColor *)
+    if (display_outline_colors[i].enabled) {
+      gdk_outline_colors[i] = (GdkColor *)
         g_malloc(sizeof(GdkColor));
 
+      c = display_outline_colors[i];
+
       /* Interpolate 8-bpp colours into 16-bpp GDK color
        * space. N.b. ignore transparency because GDK doesn't
        * understand it. */
-      colors[i].gdk_outline_color->red = r + (r<<8);
-      colors[i].gdk_outline_color->green = g + (g<<8);
-      colors[i].gdk_outline_color->blue = b + (b<<8);
-
-      error = gdk_color_alloc(colormap, colors[i].gdk_outline_color);
-
-      if (error == FALSE) {
-        g_error (_("Could not allocate color %i!\n"), i);
-      }
+      gdk_outline_colors[i]->red = c.r + (c.r<<8);
+      gdk_outline_colors[i]->green = c.g + (c.g<<8);
+      gdk_outline_colors[i]->blue = c.b + (c.b<<8);
 
-      /* Make sure the outline color is correct for non-black backgrounds */
+      /* Make sure the outline color is correct for non-black backgrounds
+       * FIXME: Is this correct?
+       */
       if (i > 0) {
-	colors[i].gdk_outline_color->red =
-		colors[i].gdk_outline_color->red ^ colors[0].gdk_color->red;
-	colors[i].gdk_outline_color->green =
-		 colors[i].gdk_outline_color->green ^
-			colors[0].gdk_color->green;
-	colors[i].gdk_outline_color->blue =
-		 colors[i].gdk_outline_color->blue ^ colors[0].gdk_color->blue;
+        gdk_outline_colors[i]->red =
+          gdk_outline_colors[i]->red ^ gdk_colors[0]->red;
+        gdk_outline_colors[i]->green =
+          gdk_outline_colors[i]->green ^ gdk_colors[0]->green;
+        gdk_outline_colors[i]->blue =
+          gdk_outline_colors[i]->blue ^ gdk_colors[0]->blue;
       }
 
-      error = gdk_color_alloc(colormap, 
-                              colors[i].gdk_outline_color);
+      error = gdk_color_alloc(colormap, gdk_outline_colors[i]);
 
       if (error == FALSE) {
         g_error (_("Could not allocate outline color %i!\n"), i);
       }
-
+    } else {
+      gdk_outline_colors[i] = NULL;
     }
   }
 }
@@ -176,8 +162,8 @@ static void x_color_allocate_all(void)
  */
 GdkColor *x_get_color(int color)
 {
-  if (colors[color].gdk_color) {
-    return(colors[color].gdk_color);
+  if (gdk_colors[color]) {
+    return(gdk_colors[color]);
   } else {
     fprintf(stderr, _("Tried to get an invalid color: %d\n"), color);
     return(&white);
@@ -192,8 +178,8 @@ GdkColor *x_get_color(int color)
  */
 GdkColor *x_get_darkcolor(int color)
 {
-  if (colors[color].gdk_outline_color) {
-    return(colors[color].gdk_outline_color);
+  if (gdk_outline_colors[color] != NULL) {
+    return(gdk_outline_colors[color]);
   } else {
     g_warning (_("Tried to get an invalid outline color: %d\n"), color);
     return(&white);
@@ -208,14 +194,15 @@ GdkColor *x_get_darkcolor(int color)
  */
 gchar *x_color_get_name(int index)
 {
+  COLOR c;
+
   if ((index >= MAX_COLORS) || (index < 0)) {
     return(NULL);
   }
 
-  if (!colors[index].enabled) return NULL;
-
-  if (colors[index].color_name) {
-    return (g_strdup(colors[index].color_name));
+  if (display_colors[index].enabled) {
+    c = display_colors[index];
+    return s_color_rgba_encode (c.r, c.g, c.b, c.a);
   }
 
   /* didn't find a color, but there still might be more */
@@ -225,5 +212,5 @@ gchar *x_color_get_name(int index)
 gboolean
 x_color_display_enabled (int index)
 {
-  return (colors[index].gdk_color != NULL);
+  return (gdk_colors[index] != NULL);
 }
diff --git a/libgeda/include/globals.h b/libgeda/include/globals.h
index 8af4c47..963bda8 100644
--- a/libgeda/include/globals.h
+++ b/libgeda/include/globals.h
@@ -24,35 +24,6 @@
 #ifndef _GLOBALS_H_INCL
 #define _GLOBALS_H_INCL
 
-
-#if 0 /* none of this is needed? */
-/* color stuff */
-extern GdkColormap *colormap; 
-extern GdkVisual *visual; 
-
-/* colors */
-extern GdkColor white;
-extern GdkColor black;
-extern GdkColor red;
-extern GdkColor green;
-extern GdkColor blue;
-extern GdkColor cyan;
-extern GdkColor yellow;
-extern GdkColor grey;
-extern GdkColor grey90;
-extern GdkColor darkgreen;
-extern GdkColor darkred;
-extern GdkColor darkyellow;
-extern GdkColor darkcyan;
-extern GdkColor darkblue;
-extern GdkColor darkgrey; 
-
-/* color structure */
-extern COLOR colors[MAX_COLORS];
-
-extern char rc_filename[256]; /* size is hack */
-#endif
-
 extern int do_logging;
 extern int logging_dest;
 
diff --git a/libgeda/include/prototype_priv.h b/libgeda/include/prototype_priv.h
index 813421a..2b53236 100644
--- a/libgeda/include/prototype_priv.h
+++ b/libgeda/include/prototype_priv.h
@@ -214,7 +214,7 @@ void s_clib_init (void);
 
 /* s_color.c */
 void s_color_init(void);
-char *s_color_ps_string(int color);
+gchar *s_color_ps_string(gint color);
 
 /* s_encoding.c */
 gchar* s_encoding_base64_encode (gchar* src, guint srclen, guint* dstlenp, gboolean strict);
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index 46b7f2c..a906eda 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -653,13 +653,7 @@ struct st_chkerrs{
 
 
 struct st_color {
-  char *color_name;
-  char *outline_color_name;
-  char *ps_color_string;
-
-  GdkColor *gdk_color;
-  GdkColor *gdk_outline_color;
-
+  guint8 r, g, b, a;
   gboolean enabled;
 };
 
diff --git a/libgeda/src/f_print.c b/libgeda/src/f_print.c
index b3e588a..236ac71 100644
--- a/libgeda/src/f_print.c
+++ b/libgeda/src/f_print.c
@@ -65,10 +65,8 @@ void f_print_set_line_width(FILE *fp, int width)
  */
 void f_print_set_color(FILE *fp, int color) 
 {
-  char *string;
+  gchar *string;
 
-  /* DO NOT free string... it's a reference to a malloced */
-  /* string, there is *no* memory leak here */
   string = s_color_ps_string(color);
 
   if (string) {
@@ -76,6 +74,8 @@ void f_print_set_color(FILE *fp, int color)
   } else {
     fprintf(fp, "0 0 0 setrgbcolor\n");
   }
+
+  g_free (string);
 }
 
 /*! \brief Prints the header to a postscript document.
diff --git a/libgeda/src/s_color.c b/libgeda/src/s_color.c
index a4857bd..6e47437 100644
--- a/libgeda/src/s_color.c
+++ b/libgeda/src/s_color.c
@@ -31,24 +31,31 @@
 #include <dmalloc.h>
 #endif
 
-COLOR colors[MAX_COLORS];
+COLOR print_colors[MAX_COLORS];
+COLOR display_colors[MAX_COLORS]; /* FIXME move into gschem */
+COLOR display_outline_colors[MAX_COLORS]; /* FIXME move into gschem */
 
-/*! \todo Finish function documentation!!!
- *  \brief
+/*! \brief Initialise the color maps to B&W
  *  \par Function Description
+ *  Initialises the print & display color maps to display black
+ *  features on a white background, with all colors disabled.
  *
+ *  \todo This should set a sensible default set of colors to be
+ *  enabled.
  */
 void s_color_init(void)
 {
   int i;
-
-  for (i = 0; i < MAX_COLORS; i++) {
-    colors[i].color_name = NULL; 
-    colors[i].outline_color_name = NULL; 
-    colors[i].ps_color_string = NULL; 
-    colors[i].gdk_color = NULL;
-    colors[i].gdk_outline_color = NULL;
-    colors[i].enabled = FALSE;
+  COLOR white = {0xff, 0xff, 0xff, 0xff, FALSE};
+  COLOR black = {0x00, 0x00, 0x00, 0xff, FALSE};
+
+  print_colors[0] = white;
+  display_colors[0] = white;
+  display_outline_colors[0] = white;
+  for (i = 1; i < MAX_COLORS; i++) {
+    print_colors[i] = black;
+    display_colors[i] = black;
+    display_outline_colors[i] = black;
   }
 
 }
@@ -160,30 +167,38 @@ s_color_request(int color_index, char *color_string,
     return(-1);
   } 
 
-  /* search for the color name see if it's already been alloced */
-
-  g_free(colors[color_index].color_name);	
+  res = s_color_rgba_decode (color_string, &r, &g, &b, &a);
+  if (!res) {
+    g_warning (_("Could not decode color: \"%s\".\n"),
+               color_string);
+  } else {
+    display_colors[color_index].r = r;
+    display_colors[color_index].g = g;
+    display_colors[color_index].b = b;
+    display_colors[color_index].enabled = TRUE;
+  }
 
-  colors[color_index].color_name = g_strdup (color_string);
-  colors[color_index].outline_color_name = g_strdup (outline_color_string);
+  res = s_color_rgba_decode (outline_color_string, &r, &g, &b, &a);
+  if (!res) {
+    g_warning (_("Could not decode color: \"%s\".\n"),
+               outline_color_string);
+  } else {
+    display_outline_colors[color_index].r = r;
+    display_outline_colors[color_index].g = g;
+    display_outline_colors[color_index].b = b;
+    display_outline_colors[color_index].enabled = TRUE;
+  }
 
   res = s_color_rgba_decode (ps_color_string, &r, &g, &b, &a);
   if (!res) {
     g_warning (_("Could not decode color: \"%s\".\n"),
                ps_color_string);
   } else {
-    if (a == 0) {
-      g_free (colors[color_index].ps_color_string);
-      colors[color_index].ps_color_string = NULL;
-    } else {
-      colors[color_index].ps_color_string =
-        g_strdup_printf ("%.3f %.3f %.3f",
-                         (gdouble) r/255.0,
-                         (gdouble) g/255.0,
-                         (gdouble) b/255.0);
-    }
+    print_colors[color_index].r = r;
+    print_colors[color_index].g = g;
+    print_colors[color_index].b = b;
+    print_colors[color_index].enabled = TRUE;
   }
-  colors[color_index].enabled = TRUE;
   return(0);
 }
 
@@ -194,14 +209,7 @@ s_color_request(int color_index, char *color_string,
  */
 void s_color_destroy_all(void)
 {
-  int i;
-
-  for (i = 0; i < MAX_COLORS; i++) {
-    g_free(colors[i].color_name);
-    g_free(colors[i].outline_color_name);
-    g_free(colors[i].ps_color_string);
-    /* free the colors */
-  }
+  /* Don't do anything, for now */
 }
 
 /*! \todo Finish function documentation!!!
@@ -209,11 +217,23 @@ void s_color_destroy_all(void)
  *  \par Function Description
  *
  */
-char *s_color_ps_string(int color)
+gchar *s_color_ps_string(gint color)
 {
-  if (colors[color].ps_color_string) {
-    return(colors[color].ps_color_string);
+  COLOR c;
+
+  if (color >= MAX_COLORS) {
+    g_warning (_("Color index out of range"));
+    return NULL;
+  }
+
+  c = print_colors[color];
+
+  if ((c.a == 0) || !c.enabled) {
+    return NULL;
   } else {
-    return(NULL);
+    return g_strdup_printf ("%.3f %.3f %.3f",
+                            (gdouble) c.r/255.0,
+                            (gdouble) c.g/255.0,
+                            (gdouble) c.b/255.0);
   }
 }

commit 05c77c57cc78b0963e52a91e6f56e8005089690a
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 15:20:14 2008 +0000

    Specify colors with RGB/RGBA hexadecimal notation only.
    
    Transparency (alpha channel) is used as follows for PostScript: if
    alpha is non-zero, objects are drawn fully opaque. If alpha is zero,
    objects are not drawn.
    
    The alpha channel is ignored for GDK drawing.

diff --git a/gschem/lib/gschem-darkbg b/gschem/lib/gschem-darkbg
index f7b486d..28e1e82 100644
--- a/gschem/lib/gschem-darkbg
+++ b/gschem/lib/gschem-darkbg
@@ -16,7 +16,8 @@
 ;
 ; Color index reference
 ;
-; All valid X color names are valid (assuming you can allocate the colors)
+; Colors may be specified in #RRGGBB or #RRGGBBAA format. If the alpha
+; value is not specified, full opacity is assumed.
 ; DO NOT change the index value of these colors, unless you understand what
 ; you are changing.
 
@@ -53,165 +54,164 @@
 
 
 
-; background-color index color_name outline_color ps_color_string 
+; background-color index display_color outline_color print_color 
 ; Set the default background color.  
 ; DO NOT change the value of the index (first number)
 ;
-(background-color 0 "black" "null" "null")  	; dark background
+(background-color 0 "#000000" "#ffffff00" "#ffffff00")  	; dark background
 
-; pin-color index color_name outline_color ps_color_string 
+; pin-color index display_color outline_color print_color 
 ; Set the color of any new pins (does not effect existing pins).
 ; To change existing pins use the override-pin-color
 ; DO NOT change the value of the index (first number)
 ;
-(pin-color 1 "white" "grey" "1 1 1") 	; dark background
+(pin-color 1 "#ffffff" "#bebebe" "#ffffff") 	; dark background
 
-; net-endpoint-color index color_name outline_color ps_color_string 
+; net-endpoint-color index display_color outline_color print_color 
 ; Set the default net endpoint color.  
 ; DO NOT change the value of the index (first number)
 ;
-(net-endpoint-color 2 "red" "red3" "1 0 0")	; dark background
+(net-endpoint-color 2 "#ff0000" "#00cd00" "#ff0000")	; dark background	
 
-; graphic-color index color_name outline_color ps_color_string 
+; graphic-color index display_color outline_color print_color 
 ; Set the default graphics color.  All new Lines, Boxes, Circles, and Arcs 
 ; are effected by this keyword.  Existing graphic objects are not effected 
 ; by this keyword.  
 ; DO NOT change the value of the index (first number)
 ; 
-(graphic-color 3 "green" "green3" "0 1 0")	; dark background
+(graphic-color 3 "#00ff00" "#00cd00" "#00ff00")	; dark background
 
-; net-color index color_name outline_color ps_color_string 
+; net-color index display_color outline_color print_color 
 ; Set the color of any new nets (does not effect existing nets).
 ; To change existing nets use the override-net-color 
 ; DO NOT change the value of the index (first number)
 ;
-(net-color 4 "blue" "blue3" "0 0 1")		; dark background
+(net-color 4 "#0000ff" "#0000cd" "#0000ff")		; dark background
 
-; attribute-color index color_name outline_color ps_color_string 
+; attribute-color index display_color outline_color print_color 
 ; Set the color of attributes.  Attributes are any object associated with 
 ; another with the 'Attach Attribute' command.  
 ; DO NOT change the value of the index (first number)
 ;
-(attribute-color 5 "yellow" "yellow3" "1 1 0") ; dark background
+(attribute-color 5 "#ffff00" "#cdcd00" "#ffff00") ; dark background
 
-; logic-bubble-color index color_name outline_color ps_color_string 
+; logic-bubble-color index display_color outline_color print_color 
 ; Set the color of logic bubbles / circles.  
 ; DO NOT change the value of the index (first number)
 ;
 ; light background  
-(logic-bubble-color 6 "cyan" "cyan3" "0 1 1") ; dark background
+(logic-bubble-color 6 "#00ffff" "#00cdcd" "#00ffff") ; dark background
 
-; grid-color index color_name outline_color ps_color_string 
+; grid-color index display_color outline_color print_color 
 ; Set the default grid color.  
 ; DO NOT change the value of the index (first number)
 ;
-(grid-color 7 "grey" "null" "null")		; dark background
+(grid-color 7 "#bebebe" "#ffffff00" "#ffffff00")		; dark background
 
-; detached-attribute-color index color_name outline_color ps_color_string 
+; detached-attribute-color index display_color outline_color print_color 
 ; Set the color of detached attributes.  Detached attributes are just 
 ; text items which were attributes at one time.  Detached attributes 
 ; are created in conjunction with the 'Detach Attribute' command.  
 ; DO NOT change the value of the index (first number)
 ;
-(detached-attribute-color 8 "red" "red3" "1 0 0")  ; dark background
+(detached-attribute-color 8 "#ff0000" "#cd0000" "#ff0000")  ; dark background
 
-; text-color index color_name outline_color ps_color_string 
+; text-color index display_color outline_color print_color 
 ; Set the color of any new text (does not effect attributes, see below).
 ; Existing graphic objects are not effected by this keyword.  
 ; DO NOT change the value of the index (first number)
 ;
-(text-color 9 "green" "green3" "0 1 0")	    ; dark background
+(text-color 9 "#00ff00" "#00cd00" "#00ff00")	    ; dark background
 
-; bus-color index color_name outline_color ps_color_string 
-;           int_red int_green int_blue 
+; bus-color index display_color outline_color print_color 
 ; Set the color of any new buses (does not effect existing buses).
 ; To change existing buses use the override-bus-color 
 ; DO NOT change the value of the index (first number)
 ;
-(bus-color 10 "green" "green3" "0 1 0")	    ; dark background
+(bus-color 10 "#00ff00" "#00cd00" "#00ff00")	    ; dark background
 
-; select-color index color_name outline_color ps_color_string 
+; select-color index display_color outline_color print_color 
 ; Set the default selection color.  This include the bounding box in window
 ; selects and when objects are selected.  
 ; DO NOT change the value of the index (first number)
 ;
-(select-color 11 "orange" "orange" "null")	    ; dark background
+(select-color 11 "#ffa500" "#ffa500" "#ffffff00")	    ; dark background
 
-; boundingbox-color index color_name outline_color ps_color_string 
+; boundingbox-color index display_color outline_color print_color 
 ; Set the default bounding box color.  The bounding box color is displayed 
 ; whenever you request that actions (move/copy/place) use a bounding box 
 ; instead of the default outline.  
 ; DO NOT change the value of the index (first number)
 ; 
-(boundingbox-color 12 "orange" "orange" "null")   ; dark background
+(boundingbox-color 12 "#ffa500" "#ffa500" "#ffffff00")   ; dark background
 
-; zoom-box-color index color_name outline_color ps_color_string 
+; zoom-box-color index display_color outline_color print_color 
 ; Set the default zoom box color.  The zoom box color is displayed 
 ; whenever you use the zoom window / box option. 
 ; DO NOT change the value of the index (first number)
 ; 
-(zoom-box-color 13 "cyan" "cyan" "null")	     ; dark background
+(zoom-box-color 13 "#00ffff" "#00ffff" "#ffffff00")	     ; dark background
 
-; stroke-color index color_name outline_color ps_color_string 
+; stroke-color index display_color outline_color print_color 
 ; Set the default stroke color which is displayed when you draw a stroke.
 ; Basically this color specifies what the mouse droppings color
 ; DO NOT change the value of the index (first number)
 ;
-(stroke-color 14 "grey90" "grey90" "null")	     ; dark background
+(stroke-color 14 "#e5e5e5" "#e5e5e5" "#ffffff00")	     ; dark background
 
-; lock-color index color_name outline_color ps_color_string 
+; lock-color index display_color outline_color print_color 
 ; Set the default lock color which is used when you lock an object down
 ; DO NOT change the value of the index (first number)
 ;
-(lock-color 15 "grey" "darkgrey" ".75 .75 .75") ; dark background
+(lock-color 15 "#bebebe" "#a9a9a9" "#bebebe") ; dark background
 
-; output-color-background index color_name outline_color ps_color_string 
+; output-color-background index display_color outline_color print_color 
 ; Specifies the color of the background of the output (color postscript file)
 ; 	- string is one of the valid colors
 ; 	- Only used if ouput-color is "enabled" (see above)
 ; DO NOT change the value of the index (first number)
 ;
-(output-color-background 16 "black" "null" "0 0 0")    ; dark background
+(output-color-background 16 "#000000" "#ffffff00" "#000000")    ; dark background
 
-; override-net-color index color_name outline_color ps_color_string 
+; override-net-color index display_color outline_color print_color 
 ; Override the color of ALL nets
 ; New net color will be applied to all nets in any file which is opened and
 ; then saved. Comment out if you don't want to override the net color.
 ; DO NOT change the value of the index (first number)
 ; 
-;(override-net-color 4 "blue" "blue3" "0 0 1")
+;(override-net-color 4 "#0000ff" "#0000cd" "#0000ff")
 
-; override-pin-color index color_name outline_color ps_color_string 
+; override-pin-color index display_color outline_color print_color 
 ; Override the color of ALL pins
 ; New pin color will be applied to all pin in any file which is opened and
 ; then saved.  Comment out if you don't want to override the pin color.
 ; DO NOT change the value of the index (first number)
 ;
-;(override-pin-color 1 "white" "grey" "1 1 1")
+;(override-pin-color 1 "#ffffff" "#bebebe" "#ffffff")
 
-; override-bus-color index color_name outline_color ps_color_string 
+; override-bus-color index display_color outline_color print_color 
 ; Override the color of ALL buses
 ; New net color will be applied to all buses in any file which is opened and
 ; then saved. Comment out if you don't want to override the bus color.
 ; DO NOT change the value of the index (first number)
 ; 
-;(override-bus-color 10 "green" "green3" "0 1 0")
+;(override-bus-color 10 "#00ff00" "#00cd00" "#00ff00")
 
-; freestyle-color index color_name outline_color ps_color_string 
+; freestyle-color index display_color outline_color print_color 
 ; Set a freestyle color which can be used in whatever context you want.
 ; However, care should be taken with this facility since users might 
 ; change this colors at will.
 ;
-;(freestyle-color 17 "color_name" "dark_color_name" "0.0 0.0 0.0")
-;(freestyle-color 18 "color_name" "dark_color_name" "0.0 0.0 0.0")
-;(freestyle-color 19 "color_name" "dark_color_name" "0.0 0.0 0.0")
-;(freestyle-color 20 "color_name" "dark_color_name" "0.0 0.0 0.0")
+;(freestyle-color 17 "#abcdef" "#abcdef" "#abcdef")
+;(freestyle-color 18 "#abcdef" "#abcdef" "#abcdef")
+;(freestyle-color 19 "#abcdef" "#abcdef" "#abcdef")
+;(freestyle-color 20 "#abcdef" "#abcdef" "#abcdef")
 
-; junction-color index color_name outline_color ps_color_string 
+; junction-color index display_color outline_color print_color 
 ; Set the default junction color.  
 ; DO NOT change the value of the index (first number)
 ;
-(junction-color 21 "yellow" "yellow3" "1 1 0")   ; dark background
+(junction-color 21 "#ffff00" "#cdcd00" "#ffff00")   ; dark background	
 
 ;
 ; End of color related keywords
diff --git a/gschem/lib/gschem-lightbg b/gschem/lib/gschem-lightbg
index e3db2a1..c856a09 100644
--- a/gschem/lib/gschem-lightbg
+++ b/gschem/lib/gschem-lightbg
@@ -16,7 +16,8 @@
 ;
 ; Color index reference
 ;
-; All valid X color names are valid (assuming you can allocate the colors)
+; Colors may be specified in #RRGGBB or #RRGGBBAA format. If the alpha
+; value is not specified, full opacity is assumed.
 ; DO NOT change the index value of these colors, unless you understand what
 ; you are changing.
 
@@ -46,177 +47,171 @@
 
 ;
 ; In all of the color modes: 
-; 	the first string is the actual color name
-;	the second string is the outline color name 
-; 	the third string is the postscript color name
+; 	the first string is the display color value
+;	the second string is the outline color value 
+; 	the third string is the postscript color value
 ;
 
 
 
-; background-color index color_name outline_color ps_color_string 
+; background-color index display_color outline_color print_color 
 ; Set the default background color.  
 ; DO NOT change the value of the index (first number)
 ;
-(background-color 0 "grey94" "null" "1 1 1") ; light background
+(background-color 0 "#f0f0f0" "#ffffff00" "#ffffff") ; light background
 
-; pin-color index color_name outline_color ps_color_string 
+; pin-color index display_color outline_color print_color 
 ; Set the color of any new pins (does not effect existing pins).
 ; To change existing pins use the override-pin-color
 ; DO NOT change the value of the index (first number)
 ;
-(pin-color 1 "black" "grey30" "0 0 0")		; light background
+(pin-color 1 "#000000" "#4d4d4d" "#000000")		; light background
 
-; net-endpoint-color index color_name outline_color ps_color_string 
+; net-endpoint-color index display_color outline_color print_color 
 ; Set the default net endpoint color.  
 ; DO NOT change the value of the index (first number)
 ;
-(net-endpoint-color 2 "red" "red3" "1 0 0")	; light background
+(net-endpoint-color 2 "#ff0000" "#cdcdcd" "#ff0000")	; light background
 
-; graphic-color index color_name outline_color ps_color_string 
+; graphic-color index display_color outline_color print_color 
 ; Set the default graphics color.  All new Lines, Boxes, Circles, and Arcs 
 ; are effected by this keyword.  Existing graphic objects are not effected 
 ; by this keyword.  
 ; DO NOT change the value of the index (first number)
 ; 
-(graphic-color 3 "green4" "green4" "0 .54 0")	; light background
+(graphic-color 3 "#008b00" "#008b00" "#008b00")	; light background
 
-; net-color index color_name outline_color ps_color_string 
+; net-color index display_color outline_color print_color 
 ; Set the color of any new nets (does not effect existing nets).
 ; To change existing nets use the override-net-color 
 ; DO NOT change the value of the index (first number)
 ;
-(net-color 4 "blue2" "blue3" "0 0 1")		; light background
-
-; attribute-color index color_name outline_color ps_color_string 
+(net-color 4 "#00008b" "#0000cd" "#0000ff")		; light background
 
+; attribute-color index display_color outline_color print_color 
 ; Set the color of attributes.  Attributes are any object associated with 
 ; another with the 'Attach Attribute' command.  
 ; DO NOT change the value of the index (first number)
 ;
-(attribute-color 5 "black" "grey30" "0 0 0")	  ; light background
+(attribute-color 5 "#000000" "#4d4d4d" "#000000")	  ; light background
 
-; logic-bubble-color index color_name outline_color ps_color_string 
+; logic-bubble-color index display_color outline_color print_color 
 ; Set the color of logic bubbles / circles.  
 ; DO NOT change the value of the index (first number)
 ;
-(logic-bubble-color 6 "DarkCyan" "DarkCyan" "0 .54 .54") ; light bg  
-
-; grid-color index color_name outline_color ps_color_string 
+(logic-bubble-color 6 "#008b8b" "#008b8b" "#008b8b") ; light bg  
 
+; grid-color index display_color outline_color print_color 
 ; Set the default grid color.  
 ; DO NOT change the value of the index (first number)
 ;
-(grid-color 7 "grey50" "null" "null")		; light background
+(grid-color 7 "#7f7f7f" "#ffffff00" "#ffffff00")		; light background
 
-; detached-attribute-color index color_name outline_color ps_color_string 
+; detached-attribute-color index display_color outline_color print_color 
 ; Set the color of detached attributes.  Detached attributes are just 
 ; text items which were attributes at one time.  Detached attributes 
 ; are created in conjunction with the 'Detach Attribute' command.  
 ; DO NOT change the value of the index (first number)
 ;
-(detached-attribute-color 8 "red" "red3" "1 0 0")   ; light background
-
-; text-color index color_name outline_color ps_color_string 
+(detached-attribute-color 8 "#ff0000" "#cd0000" "#ff0000")   ; light background
 
+; text-color index display_color outline_color print_color 
 ; Set the color of any new text (does not effect attributes, see below).
 ; Existing graphic objects are not effected by this keyword.  
 ; DO NOT change the value of the index (first number)
 ;
-(text-color 9 "green4" "green4" "0 .54 0")	    ; light background
+(text-color 9 "#008b00" "#008b00" "#008b00")	    ; light background
 
-; bus-color index color_name outline_color ps_color_string 
+; bus-color index display_color outline_color print_color 
 ; Set the color of any new buses (does not effect existing buses).
 ; To change existing buses use the override-bus-color 
 ; DO NOT change the value of the index (first number)
 ;
-(bus-color 10 "green2" "green3" "0 .9333 0")	    ; light background
-
-; select-color index color_name outline_color ps_color_string 
+(bus-color 10 "#00ee00" "#00cd00" "#00ee00")	    ; light background
 
+; select-color index display_color outline_color print_color 
 ; Set the default selection color.  This include the bounding box in window
 ; selects and when objects are selected.  
 ; DO NOT change the value of the index (first number)
 ;
-(select-color 11 "firebrick" "firebrick" "null")   ; light background
+(select-color 11 "#b22222" "#b22222" "#ffffff00")   ; light background
 
-; boundingbox-color index color_name outline_color ps_color_string 
+; boundingbox-color index display_color outline_color print_color 
 
 ; Set the default bounding box color.  The bounding box color is displayed 
 ; whenever you request that actions (move/copy/place) use a bounding box 
 ; instead of the default outline.  
 ; DO NOT change the value of the index (first number)
 ; 
-(boundingbox-color 12 "orange" "orange" "null")    ; light background
+(boundingbox-color 12 "#ffa500" "#ffa500" "#ffffff00")    ; light background
 
-; zoom-box-color index color_name outline_color ps_color_string 
+; zoom-box-color index display_color outline_color print_color 
 ; Set the default zoom box color.  The zoom box color is displayed 
 ; whenever you use the zoom window / box option. 
 ; DO NOT change the value of the index (first number)
 ; 
-(zoom-box-color 13 "DarkCyan" "DarkCyan" "null")    ; light background
-
-; stroke-color index color_name outline_color ps_color_string 
+(zoom-box-color 13 "#008b8b" "#008b8b" "#ffffff00")    ; light background
 
+; stroke-color index display_color outline_color print_color 
 ; Set the default stroke color which is displayed when you draw a stroke.
 ; Basically this color specifies what the mouse droppings color
 ; DO NOT change the value of the index (first number)
 ;
-(stroke-color 14 "purple" "purple" "null")	     ; light background
+(stroke-color 14 "#a020f0" "#a020f0" "#ffffff00")	     ; light background
 
-; lock-color index color_name outline_color ps_color_string 
+; lock-color index display_color outline_color print_color 
 ; Set the default lock color which is used when you lock an object down
 ; DO NOT change the value of the index (first number)
 ;
-(lock-color 15 "grey40" "darkgrey" ".4 .4 .4")   ; light background
-
-; output-color-background index color_name outline_color ps_color_string 
+(lock-color 15 "#666666" "#a9a9a9" "#666666")   ; light background
 
+; output-color-background index display_color outline_color print_color 
 ; Specifies the color of the background of the output (color postscript file)
 ; 	- string is one of the valid colors
 ; 	- Only used if ouput-color is "enabled" (see above)
 ; DO NOT change the value of the index (first number)
 ;
-(output-color-background 16 "white" "null" "1 1 1") ; light back
+(output-color-background 16 "#ffffff" "#ffffff" "#ffffff") ; light back
 
-; override-net-color index color_name outline_color ps_color_string 
+; override-net-color index display_color outline_color print_color 
 ; Override the color of ALL nets
 ; New net color will be applied to all nets in any file which is opened and
 ; then saved. Comment out if you don't want to override the net color.
 ; DO NOT change the value of the index (first number)
 ; 
-;(override-net-color 4 "blue" "blue3" "0 0 1")
+;(override-net-color 4 "#0000ff" "#0000cd" "#0000ff")
 
-; override-pin-color index color_name outline_color ps_color_string 
+; override-pin-color index display_color outline_color print_color 
 ; Override the color of ALL pins
 ; New pin color will be applied to all pin in any file which is opened and
 ; then saved.  Comment out if you don't want to override the pin color.
 ; DO NOT change the value of the index (first number)
 ;
-;(override-pin-color 1 "white" "grey" "1 1 1")
+;(override-pin-color 1 "#ffffff" "#bebebe" "#ffffff")
 
-; override-bus-color index color_name outline_color ps_color_string 
+; override-bus-color index display_color outline_color print_color 
 ; Override the color of ALL buses
 ; New net color will be applied to all buses in any file which is opened and
 ; then saved. Comment out if you don't want to override the bus color.
 ; DO NOT change the value of the index (first number)
 ; 
-;(override-bus-color 10 "green" "green3" "0 1 0")
+;(override-bus-color 10 "#00ff00" "#00cd00" "#00ff00")
 
-; freestyle-color index color_name outline_color ps_color_string 
+; freestyle-color index display_color outline_color print_color 
 ; Set a freestyle color which can be used in whatever context you want.
 ; However, care should be taken with this facility since users might 
 ; change this colors at will.
 ;
-;(freestyle-color 17 "color_name" "dark_color_name" "0.0 0.0 0.0")
-;(freestyle-color 18 "color_name" "dark_color_name" "0.0 0.0 0.0")
-;(freestyle-color 19 "color_name" "dark_color_name" "0.0 0.0 0.0")
-;(freestyle-color 20 "color_name" "dark_color_name" "0.0 0.0 0.0")
+;(freestyle-color 17 "#abcdef" "#abcdef" "#abcdef")
+;(freestyle-color 18 "#abcdef" "#abcdef" "#abcdef")
+;(freestyle-color 19 "#abcdef" "#abcdef" "#abcdef")
+;(freestyle-color 20 "#abcdef" "#abcdef" "#abcdef")
 
-; junction-color index color_name outline_color ps_color_string 
+; junction-color index display_color outline_color print_color 
 ; Set the default junction color.  
 ; DO NOT change the value of the index (first number)
 ;
-(junction-color 21 "purple" "purple3" ".627 .125 .941") 
+(junction-color 21 "#a020f0" "#7e26cd" "#a020f0") 
 ; light background
 
 ;
diff --git a/gschem/src/x_color.c b/gschem/src/x_color.c
index a81e081..f837e7b 100644
--- a/gschem/src/x_color.c
+++ b/gschem/src/x_color.c
@@ -89,69 +89,62 @@ static void x_color_allocate_all(void)
 {
   int error;
   int i;		
+  guint8 r, g, b, a;
 
   for (i = 0; i < MAX_COLORS; i++) {
     if (!colors[i].enabled) continue;
     if (colors[i].color_name) {
+      error = s_color_rgba_decode (colors[i].color_name,
+                                   &r, &g, &b, &a);
+      if (!error) {
+        g_warning (_("Could not decode color: \"%s\". "
+                     "Defaulting to white.\n"),
+                   colors[i].color_name);
+      }
+
       colors[i].gdk_color = (GdkColor *)
         g_malloc(sizeof(GdkColor));
 
-      error = gdk_color_parse(colors[i].color_name, 
-                              colors[i].gdk_color);
-
-      if (error == FALSE) {
-        fprintf(stderr, 
-                _("Could not find the color %s!\n"), 
-                colors[i].color_name);
-        fprintf(stderr, 
-                _("Defaulting color to white\n"));
-
-        error = gdk_color_parse("white", 
-                                colors[i].gdk_color);
-
-        if (error == FALSE) {
-          fprintf(stderr, 
-                  _("Ack! Cannot allocate white!\n"));
-          exit(-1);
-        }
-
-      }
-
+      /* Interpolate 8-bpp colours into 16-bpp GDK color
+       * space. N.b. ignore transparency because GDK doesn't
+       * understand it. */
+      colors[i].gdk_color->red = r + (r<<8);
+      colors[i].gdk_color->green = g + (g<<8);
+      colors[i].gdk_color->blue = b + (b<<8);
 
       error = gdk_color_alloc(colormap, colors[i].gdk_color);
 
       if (error == FALSE) {
-        fprintf(stderr, 
-                _("Could not allocate the color %s!\n"), 
-                colors[i].color_name);
-        exit(-1);
+        g_error (_("Could not allocate display color %i!\n"), i);
       }
 
     }
+  }
 
+  for (i = 0; i < MAX_COLORS; i++) {
     if (colors[i].outline_color_name) {
+      error = s_color_rgba_decode (colors[i].outline_color_name,
+                                   &r, &g, &b, &a);
+      if (!error) {
+        g_warning (_("Could not decode color: \"%s\". "
+                     "Defaulting to white.\n"),
+                   colors[i].outline_color_name);
+      }
+
       colors[i].gdk_outline_color = (GdkColor *)
         g_malloc(sizeof(GdkColor));
 
-      error = gdk_color_parse(colors[i].outline_color_name, 
-                              colors[i].gdk_outline_color);
+      /* Interpolate 8-bpp colours into 16-bpp GDK color
+       * space. N.b. ignore transparency because GDK doesn't
+       * understand it. */
+      colors[i].gdk_outline_color->red = r + (r<<8);
+      colors[i].gdk_outline_color->green = g + (g<<8);
+      colors[i].gdk_outline_color->blue = b + (b<<8);
 
-      if (error == FALSE) {
-        fprintf(stderr, 
-                _("Could not find the color %s!\n"), 
-                colors[i].outline_color_name);
-        fprintf(stderr, 
-                _("Defaulting color to white\n"));
-
-        error = gdk_color_parse("white", 
-                                colors[i].gdk_outline_color);
-
-        if (error == FALSE) {
-          fprintf(stderr, 
-                  _("Ack! Cannot allocate white!\n"));
-          exit(-1);
-        }
+      error = gdk_color_alloc(colormap, colors[i].gdk_outline_color);
 
+      if (error == FALSE) {
+        g_error (_("Could not allocate color %i!\n"), i);
       }
 
       /* Make sure the outline color is correct for non-black backgrounds */
@@ -169,10 +162,7 @@ static void x_color_allocate_all(void)
                               colors[i].gdk_outline_color);
 
       if (error == FALSE) {
-        fprintf(stderr, 
-                _("Could not allocate the color %s!\n"), 
-                colors[i].outline_color_name);
-        exit(-1);
+        g_error (_("Could not allocate outline color %i!\n"), i);
       }
 
     }
@@ -186,7 +176,7 @@ static void x_color_allocate_all(void)
  */
 GdkColor *x_get_color(int color)
 {
-  if (colors[color].color_name) {
+  if (colors[color].gdk_color) {
     return(colors[color].gdk_color);
   } else {
     fprintf(stderr, _("Tried to get an invalid color: %d\n"), color);
@@ -202,10 +192,10 @@ GdkColor *x_get_color(int color)
  */
 GdkColor *x_get_darkcolor(int color)
 {
-  if (colors[color].outline_color_name) {
+  if (colors[color].gdk_outline_color) {
     return(colors[color].gdk_outline_color);
   } else {
-    fprintf(stderr, _("Tried to get an invalid color: %d\n"), color);
+    g_warning (_("Tried to get an invalid outline color: %d\n"), color);
     return(&white);
   }
 
diff --git a/libgeda/include/prototype.h b/libgeda/include/prototype.h
index 76ed88b..bb295e4 100644
--- a/libgeda/include/prototype.h
+++ b/libgeda/include/prototype.h
@@ -352,7 +352,10 @@ gchar *s_clib_symbol_get_data_by_name (const gchar *name);
 GList *s_toplevel_get_symbols (const TOPLEVEL *toplevel);
 
 /* s_color.c */
-int s_color_request(int color_index, char *color_name, char *outline_color_name, char *ps_color_string);
+gboolean s_color_rgba_decode (const gchar *rgba,
+                              guchar *r, guchar *g, guchar *b, guchar *a);
+gchar *s_color_rgba_encode (guint8 r, guint8 g, guint8 b, guint8 a);
+int s_color_request(int color_index, char *color_string, char *outline_color_string, char *ps_color_string);
 void s_color_destroy_all(void);
 
 /* s_conn.c */
diff --git a/libgeda/po/POTFILES.in b/libgeda/po/POTFILES.in
index 6e70553..1cdd0ce 100644
--- a/libgeda/po/POTFILES.in
+++ b/libgeda/po/POTFILES.in
@@ -23,6 +23,7 @@ src/o_picture.c
 src/o_pin_basic.c
 src/o_text_basic.c
 src/s_clib.c
+src/s_color.c
 src/s_hierarchy.c
 src/s_page.c
 src/s_slib.c
diff --git a/libgeda/src/s_color.c b/libgeda/src/s_color.c
index 8cde130..a4857bd 100644
--- a/libgeda/src/s_color.c
+++ b/libgeda/src/s_color.c
@@ -53,6 +53,88 @@ void s_color_init(void)
 
 }
 
+/* \brief Decode a hexadecimal RGB or RGBA color code.
+ * \par Function Description
+ * Accepts a hexadecimal color code \a rgba of either the form #RRGGBB
+ * or #RRGGBBAA, and parses it to extract the numerical color values,
+ * placing them in the the #guchar pointers passed as arguments. If
+ * the six-digit form is used, the alpha channel is set to full
+ * opacity. If an error occurs during parsing, the return values are
+ * set to solid white.
+ *
+ * Note that this function implements similar functionality to
+ * gdk_color_parse(). However, for consistency, <em>only</em> this
+ * function should be used to parse color strings from gEDA
+ * configuration files, as gdk_color_parse() does not support the
+ * alpha channel.
+ *
+ * \todo Use GError mechanism to give more specific error messages.
+ *
+ * \param [in]  rgba Colour code to parse.
+ * \param [out] r    Location to store red value.
+ * \param [out] g    Location to store green value.
+ * \param [out] b    Location to store blue value.
+ *
+ *  \returns #TRUE on success, #FALSE on failure.
+ */
+gboolean
+s_color_rgba_decode (const gchar *rgba,
+                     guint8 *r, guint8 *g, guint8 *b, guint8 *a)
+{
+  gint len, i;
+  gchar c;
+
+  /* Check that the string is a valid length and starts with a '#' */
+  len = strnlen (rgba, 10);
+  if ((len != 9 && len != 7) || rgba[0] != '#') goto rgba_decode_err;
+
+  /* Check we only have [0-9a-fA-F] */
+  for (i = 1; i < len; i++) {
+    c = rgba[i];
+    if ((c < '0' || c > '9')
+        && (c < 'a' || c > 'f')
+        && (c < 'A' || c > 'F')) {
+      goto rgba_decode_err;
+    }
+  }
+
+  /* Use sscanf to extract values */
+  c = sscanf (rgba + 1, "%2hhx%2hhx%2hhx", r, g, b);
+  if (c != 3) goto rgba_decode_err;
+
+  if (len == 9) {
+    c = sscanf (rgba + 7, "%2hhx", a);
+  if (c != 1) goto rgba_decode_err;
+  }
+
+  return TRUE;
+
+ rgba_decode_err:
+  /* Default to solid white */
+  *r = 0xff; *g = 0xff; *b = 0xff; *a = 0xff;
+  return FALSE;
+}
+
+/* \brief Encode a hexadecimal RGB or RGBA color code.
+ * \par Function Description
+ * Encodes four colour components into either the form #RRGGBB or
+ * #RRGGBBAA. The shorter form is used when the alpha component is
+ * 0xff.
+ *
+ * \param [in] r Red component.
+ * \param [in] g Green component.
+ * \param [in] b Blue component.
+ * \returns A newly allocated string containing the encoded string.
+ */
+gchar *
+s_color_rgba_encode (guint8 r, guint8 g, guint8 b, guint8 a)
+{
+  if (a < 0xff)
+    return g_strdup_printf("#%02hhx%02hhx%02hhx%02hhx", r, g, b, a);
+  else
+    return g_strdup_printf("#%02hhx%02hhx%02hhx", r, g, b);
+}
+
 /*! \todo Finish function documentation!!!
  *  \brief
  *  \par Function Description
@@ -60,9 +142,12 @@ void s_color_init(void)
  */
 /* you are allowed to call this function with the same color index again and */
 /* and again, last call is the final color request */
-int s_color_request(int color_index, char *color_name,
-		    char *outline_color_name, char *ps_color_string)
+int
+s_color_request(int color_index, char *color_string,
+                char *outline_color_string, char *ps_color_string)
 {
+  guint8 r, g, b, a;
+  gboolean res;
 
 #if 0
   if (colors[color_index].color_name) {
@@ -79,18 +164,24 @@ int s_color_request(int color_index, char *color_name,
 
   g_free(colors[color_index].color_name);	
 
-  colors[color_index].color_name = g_strdup (color_name);
+  colors[color_index].color_name = g_strdup (color_string);
+  colors[color_index].outline_color_name = g_strdup (outline_color_string);
 
-  if (strcmp(outline_color_name, "null") != 0) {
-    colors[color_index].outline_color_name = g_strdup (outline_color_name);
-  } else {
-    colors[color_index].outline_color_name = NULL;
-  }
-	
-  if (strcmp(ps_color_string, "null") != 0) {
-    colors[color_index].ps_color_string = g_strdup( ps_color_string);
+  res = s_color_rgba_decode (ps_color_string, &r, &g, &b, &a);
+  if (!res) {
+    g_warning (_("Could not decode color: \"%s\".\n"),
+               ps_color_string);
   } else {
-    colors[color_index].ps_color_string = NULL;
+    if (a == 0) {
+      g_free (colors[color_index].ps_color_string);
+      colors[color_index].ps_color_string = NULL;
+    } else {
+      colors[color_index].ps_color_string =
+        g_strdup_printf ("%.3f %.3f %.3f",
+                         (gdouble) r/255.0,
+                         (gdouble) g/255.0,
+                         (gdouble) b/255.0);
+    }
   }
   colors[color_index].enabled = TRUE;
   return(0);

commit e2d6f2bfb1c24d5dfaf193dfae4aaa7cf4d0f236
Author: Peter TB Brett <peter@xxxxxxxxxxxxx>
Date:   Mon Dec 22 00:36:27 2008 +0000

    Add explicit 'enabled' field to COLOR structure.
    
    Colors are implicitly 'enabled' by having values specified in the
    configuration file. Up until now, whether a given color is enabled has
    been checked by checking if the color name strings are NULL.
    
    This patch adds an explicit 'enabled' field to the COLOR structure. It
    is set TRUE when s_color_request() is called for that color index.

diff --git a/gschem/include/prototype.h b/gschem/include/prototype.h
index 7c455be..aa58252 100644
--- a/gschem/include/prototype.h
+++ b/gschem/include/prototype.h
@@ -744,6 +744,7 @@ void x_color_free (void);
 GdkColor *x_get_color(int color);
 GdkColor *x_get_darkcolor(int color);
 gchar *x_color_get_name(int index);
+gboolean x_color_display_enabled (int index);
 /* x_dialog.c */
 int text_view_calculate_real_tab_width(GtkTextView *textview, int tab_size);
 void select_all_text_in_textview(GtkTextView *textview);
diff --git a/gschem/src/x_color.c b/gschem/src/x_color.c
index 9a69b44..a81e081 100644
--- a/gschem/src/x_color.c
+++ b/gschem/src/x_color.c
@@ -91,6 +91,7 @@ static void x_color_allocate_all(void)
   int i;		
 
   for (i = 0; i < MAX_COLORS; i++) {
+    if (!colors[i].enabled) continue;
     if (colors[i].color_name) {
       colors[i].gdk_color = (GdkColor *)
         g_malloc(sizeof(GdkColor));
@@ -221,11 +222,18 @@ gchar *x_color_get_name(int index)
     return(NULL);
   }
 
-  /* only if these two variables are not null is the color settable */
-  if (colors[index].color_name && colors[index].outline_color_name) {
+  if (!colors[index].enabled) return NULL;
+
+  if (colors[index].color_name) {
     return (g_strdup(colors[index].color_name));
   }
 
   /* didn't find a color, but there still might be more */
   return(NULL);
 }
+
+gboolean
+x_color_display_enabled (int index)
+{
+  return (colors[index].gdk_color != NULL);
+}
diff --git a/gschem/src/x_dialog.c b/gschem/src/x_dialog.c
index fadf6d4..0848650 100644
--- a/gschem/src/x_dialog.c
+++ b/gschem/src/x_dialog.c
@@ -2352,10 +2352,8 @@ create_color_menu (GSCHEM_TOPLEVEL *w_current)
 
   /* Populate the list */
   for (i = 0; i < MAX_COLORS; i++) {
-    /* Skip 'invalid' colors. FIXME this is ugly. */
-    gchar *buf = x_color_get_name(i);
-    if (buf == NULL) continue;
-    g_free (buf);
+    /* Skip 'invalid' colors. */
+    if (!x_color_display_enabled(i)) continue;
 
     str = index2functionstring (i);
     gtk_list_store_append (store, &iter);
diff --git a/libgeda/include/struct.h b/libgeda/include/struct.h
index 50e0cc5..46b7f2c 100644
--- a/libgeda/include/struct.h
+++ b/libgeda/include/struct.h
@@ -659,6 +659,8 @@ struct st_color {
 
   GdkColor *gdk_color;
   GdkColor *gdk_outline_color;
+
+  gboolean enabled;
 };
 
 
diff --git a/libgeda/src/s_color.c b/libgeda/src/s_color.c
index aeba396..8cde130 100644
--- a/libgeda/src/s_color.c
+++ b/libgeda/src/s_color.c
@@ -48,6 +48,7 @@ void s_color_init(void)
     colors[i].ps_color_string = NULL; 
     colors[i].gdk_color = NULL;
     colors[i].gdk_outline_color = NULL;
+    colors[i].enabled = FALSE;
   }
 
 }
@@ -91,6 +92,7 @@ int s_color_request(int color_index, char *color_name,
   } else {
     colors[color_index].ps_color_string = NULL;
   }
+  colors[color_index].enabled = TRUE;
   return(0);
 }
 




_______________________________________________
geda-cvs mailing list
geda-cvs@xxxxxxxxxxxxxx
http://www.seul.org/cgi-bin/mailman/listinfo/geda-cvs