1. Home
  2. RGB

RGB

RGB(r; g; b) and RGB(t) calculate RGB colour values. If there are three arguments, r, g and b, these must be numerical structures specifying the red, green and blue components of the colour (which must all be in the range 0-255). If there is a single argument, t, this must be a text containing names of the standard Genstat colours. The text can contain the string ‘match‘ in its second and subsequent units, to repeat the colour in the previous unit. It can also contain strings made up of three pairs of hexadecimal digits (00-FF) prefixed by #, 0x or 0X: i.e. '#rgb', '0xrgb' or '0Xrgb' where rgb are pairs of hexadecimal digits 00-FF that define the red, green and blue intensities of the colour respectively. For example, '#FF0000', '#00FF00' and '#0000FF' give pure red, green and blue respectively. The leading zeros can be dropped, so '#FF00' and '#FF' also define green and blue respectively.

Updated on October 28, 2020

Was this article helpful?