[PythonCAD] colors

Eric Wilhelm ewilhelm at sbcglobal.net
Tue Jul 27 23:07:07 CEST 2004

# The following was supposedly scribed by
# Art Haas
# on Tuesday 27 July 2004 10:06 am:

> I like the '#xxxxxx' format
>for specifying colors

I agree.

Is this scheme actually used to paint the entities now, or is it a 

>I've not thought of having a layer color before, though how you
>represent it above makes sense. If such a feature gets added to the
>program, I'd want to see the entities reference the color in a different
>manner than by using the "color=" attribute. I don't know just what
>right now, but I'm not initially keen on the '#BYLAYER' approach. I
>don't like the idea of having "color=" be something other than a hex
>formatted color string.

Now that I think of it, why bother having the # ? You could use a different 
symbol as the leader to indicate that it is a directive and not a literal 
color (maybe "&bylayer".)

Consider this.  If you have color="3" referring to an indexed color right now, 
re-using that as color="#FFFF00" is going to mean some kind of compatibility 
function (for at least some period of time) to enable loading older pythoncad 
files. (?)  If so, that function could easily handle color="bylayer" or some 
non-integer, non-hex directive.

I'm looking at Interface/Gtk/gtkimage.py at around line 170, and it looks like 
you have to allocate a color before you can paint the item onto the canvas.  
Let me know if I'm off-track.

So, is the xml a reflection of the 'image' data structure?

>As for layer colors, I that ability something that is used frequently in
>AutoCAD? I don't see much use for it initially ...

I've used it a lot.  AutoCAD (and presumably microstation) also has support 
for defining linetypes and lineweights as 'by layer'.  This allows you to 
make a change in one place and have an impact on multiple entities.  In 
viewing, it is not as applicable, but it plays a large role in plotting.

In terms of pythoncad's use and support of layer colors, maybe it should have 
something to do with the active layer / inactive layer colors that I 
mentioned before.

If I disable the 'active-layer-highlighting' (when this becomes possible), 
what should happen?

One possible theme:

Layers have colors, and entities can inherit the layers color (and do so by 

When highlighting is off, the layers are displayed in their colors and 
entities with color over-rides are displayed in the entity's color.  When 
highlighting is set to 'mask' (a new form of 'on'), the colors of the layers 
and entities is masked against the 'background mask' color.  When 
highlighting is set to 'solid' (the current form of 'on' ?) , the background 
layers are displayed with the 'background color' color.

I arise in the morning torn between a desire to improve the world and a
desire to enjoy the world. This makes it hard to plan the day. 
                                        --E.B. White

More information about the PythonCAD mailing list