.. _example_11: (11) A 3-D RGB color cube ------------------------- In this example we generate a series of 6 color images, arranged so that they can be cut out and assembled into a 3-D color cube. The six faces of the cube represent the outside of the R-G-B color space. On each face one of the color components is fixed at either 0 or 255 and the other two components vary smoothly across the face from 0 to 255. The cube is configured as a right-handed coordinate system with *x-y-z* mapping R-G-B. Hence, the 8 corners of the cube represent the primaries red, green, and blue, plus the secondaries cyan, magenta and yellow, plus black and white. The 6 color faces are generated by feeding :doc:`grdimage ` three grids, one for each color component (R, G, and B). In some cases the X or Y axes of a face are reversed by specifying a negative width or height in order to change the variation of the color value in that direction from ascending to descending, or vice versa. A number of rays emanating from the white and black corners indicate the Hue value (ranging from 0 to 360). The dashed and dotted lines near the white corner reflect saturation levels, running from 0 to 1 (in black font). On these 3 faces the brightness is a constant value of 1. On the other 3 faces of the cube, around the black corner, the white decimal numbers indicate brightnesses between 0 and 1, with saturation fixed at 1. .. literalinclude:: /_verbatim/example_11.txt :language: bash .. _fig_ex11: .. figure:: /_images/example_11.* :width: 500 px :align: center The RGB color cube