Predefined Functions – rgb
|Function name:||rgb – Create color from real arguments|
|Input data type||Output data type|
|real, real, real||color|
rgb(<red>,<green>,<blue>) returns a color which is initialized according to the three parameters passed to the function. The parameters
<blue> for this function should be in the range from 0 to 1. The fourth color component, the alpha value of the color, is always set to 1 (i.e. color is totally opaque). If you want to initialize the alpha value as well, please use the rgba-function
rgb(0,0,0) returns a black color,
rgb(1,1,1) returns white. On initializing the color no bounds checking is done, so
rgb(5,0,0) creates a color whose red-part is beyond the valid range. On output the value will be truncated to a correct interval (i.e.
rgb(1,0,0). But some other functions like the merging functions do not truncate a color in any way: They then will use that value.
So it’s legal to create colors whose parts are not in the valid range from 0 to 1, but you should know what you do…