color operation

Syntax

  • color(s)
  • color(r,g,b)
  • color(r,g,b,o)

Parameters

  1. sstring
    Color to set, in the format "#rrggbb" or "#rrggbboo" (hex).
  2. rfloat (range[0.0, 1.0] )
    Color to set in red components.
  3. gfloat (range[0.0, 1.0] )
    Color to set in green components.
  4. bfloat (range[0.0, 1.0] )
    Color to set in blue components.
  5. ofloat (range[0.0, 1.0] )
    Color to set in opacity components.

Description

The color operation sets the color of the current shape's material. This command has the same effect as set(material.color.{ r | g | b }, val), it is a shortcut for convenience.

Related

Examples

Three ways to set a shape's color. The results are identical.

Lot-->
   extrude(20)
   split(x) { 2  : color("#ff0000") 
                   X
            | 2  : color(1, 0, 0) 
                   X 
            | 2  : set(material.color.r, 1.0) 
                   set(material.color.g, 0) 
                   set(material.color.b, 0) 
                   X }
Shape with color

In this topic