Home | Pictures of 3D objects

# Color In the RGB color system, you specify a color in terms of fractions of red, green, and blue, corresponding to how strongly glowing are the tiny red, green, and blue dots of the computer screen. In the RGB scheme, white is the color with a maximum of red, blue, and green (1, 1, 1). Black has minimum amounts (0, 0, 0). The brightest red is represented by (1, 0, 0); that is, it has the full amount of red, no green, and no blue. Here are examples of RGB colors, with names you can use in GlowScript:
vec(1,0,0) color.red | vec(1,1,0) color.yellow
vec(0,1,0) color.green | vec(1,0.5,0) color.orange
vec (0,0,1) color.blue | vec(0,1,1) color.cyan
vec(1,0,1) color.magenta |
vec(0,0,0) color.black | vec(1,1,1) color.white
You can also create your own colors, such as these: vec(0.5, 0.5, 0.5) a rather dark gray; or say color=color.gray(0.5) to mean (0.5,0.5,0.5) vec(1,0.7,0.2) a coppery color Colors may appear differently on different computers, and under different 3D lighting conditions. The named colors above are most likely to display appropriately, because RGB values of 0 or 1 are unaffected by differing color corrections ("gamma" corrections). GlowScript only accepts RGB color descriptions, but there are functions for converting color triples between RGB and HSV (hue, saturation, and value or intensity): c = vec(1,1,0) # Convert RGB to HSV: c2 = color.rgb_to_hsv(c) # c2 is now vec(0.16667, 1, 1) # Convert back to RGB: c3 = color.hsv_to_rgb(c2) # c3 is now vec(1, 1, 0) Another example: sphere( color:hsv_to_rgb( vec(0.5,1,0.8) ) You can explore the RGB and HSV color systems in the GlowScript example program Color-RGB-HSV.

Top of page