Color

From Tygron Support wiki
Revision as of 12:43, 14 February 2020 by Rudolf@tygron.nl (talk | contribs)
Jump to navigation Jump to search
This article is a stub.

Color is a usually expressed through a number of values, the combination fo which expresses an exact color. An example of such a format is RGB, in which three values represent the amount of red, blue, and green displayed respectively.

Many spatial components with attributes automatically have a "COLOR" attribute added to them, indicating the color used when the components are displayed. The value is the same as the color property of that component. When that color property is changed, the attribute is changed, and vice versa.

Color values can be configured in a couple of ways.

Single value format

For optimal compatibility between formats which only allow the reading and setting of a single value, the color can be read and stored as a single value as well. The numeric value corresponds to an RGB color value, calculated by combining the red, green and blue values of the desired color together, multiplied by powers of 256. The amount of red, green, and blue are values between 0 and 255, inclusive. These are added to a base value of -16777216. A proper color value can be calculated as follows: -16777216 + (red * 256²) + (green * 256) + (blue).

RGB(A) format

Using Attribute arrays, a color can also be written as a list of 3 separate values in a single attribute, representing red, green, and blue respectively. Any of these colors values van range from 0 to 255. Optionally, a 4th value can be added representing the "alpha" of the color, which indicates the opacity. This value too can range from 0 (fully transparent) to 255 (fully opaque).