patch: named colors

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

patch: named colors

Dear OpenSCAD,

Here is a patch to allow the color() command to use names as well as numbers.


The command color([1,0,0]) can be written as color("red")
The command color([0,1,0,0.4]), which includes alpha, can be written
as color("green,0.4")

Color names come from the 'SVG colors' via QColor. Please see or


This patch prints a warning in the OpenSCAD Console if an unknown
color name is used.

QT prints a warning to stdout if an invalid color name is used.  Please see

An example .scad file showing most (all?) of the named colors is attached

Thank you


named_colors.diff (1K) Download Attachment
testcolornames.scad (10K) Download Attachment