User Tools

Site Tools


en:color

This is an old revision of the document!


Color (Statement)

Format

color color_name
color ( color_name )
color rgb_expr
color ( rgb_expr )
color pen_color_name , brush_color_name
color ( pen_color_name , brush_color_name )
color pen_rgb_expr , brush_rgb_expr
color ( pen_rgb_expr , brush_rgb_expr )

Description

Sets the current drawing color to colorname or to an ARGB value where ( (a * 256 + r) * 256 + b) * 256 + g. If a single color is specified both the pen and the brush will be set to the same color.

When drawing solid shapes (Chord,Circle,Pie,Poly,Rect, and Stamp) the border of the shape will be drawn with the pen color and the shape itself will be filled with the brush color. A brush color of CLEAR is used to not fill a closed shape.

If the current pen and brush are both set to CLEAR the pixels or shapes drawn will clear the pixels of the graphics output area and make them transparent. This is especially useful when creating sprites using the Spriteslice command.

Color names and RGB values

Color NameARGB ValuesInteger
black255, 0, 0, 04278190080Black
white255, 255, 255, 2554294506744White
red255, 255, 0, 04294901760<hi #FF0000>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
darkred255, 128, 0, 04286578688<hi #800000>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
green255, 0, 255, 04278255360<hi #00FF00>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
darkgreen255, 0, 128, 04278222848<hi #008000>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
blue255, 0, 0, 2554278190335<hi #0000FF>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
darkblue255, 0, 0, 1284278190208<hi #000080>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
cyan255, 0, 255, 2554278255615<hi #00FFFF>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
darkcyan255, 0, 128, 1284278222976<hi #008080>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
purple255, 255, 0, 2554294902015<hi #FF00FF>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
darkpurple255, 128, 0, 1284286578816<hi #800080>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
yellow255, 255, 255, 04294967040<hi #FFFF00>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
darkyellow255, 128, 128 ,04286611456<hi #808000>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
orange255, 255, 102, 04294927872<hi #FF6600>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
darkorange255, 176, 61 ,04289344256<hi #B03D00>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
grey255, 164, 164 ,1644288980132<hi #A4A4A4>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
darkgrey255, 128, 128 ,1284286611584<hi #808080>~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~~~SP~~</hi>
clear0, 0, 0, 00~~SP~~

Deprecated Form

In version 0.9.9.26 the statement form “color red, blue, green” or “color ( red, blue, green )” was deprecated and a warning will be displayed when it is encountered. It should be replaced with “color rgb ( red, blue, green )”.

Example

clg
color rgb(128,128,128)
rect 0,0,graphwidth, graphheight

penwidth 5
color green,red
circle 100,100,50

penwidth 1
color rgb(255,160,160)
circle 100,100,25

Will draw a grey rectangle with a green circle filled with red and then a pink circle inside it.
Color

See Also

2016/01/01 22:42

History

0.9.5madded “COLOR r,g,b” form and numeric representation of color names
0.9.9.26Added brush color and deprecated the “COLOR r,g,b”.
0.9.9.28Changed color values to include Alpha (transparency) and changed color constants to new ARGB values.
0.9.9.45changed values to positive numbers following formula as documented.
en/color.1470687851.txt.gz · Last modified: 2020/02/28 10:46 (external edit)