Color: Difference between revisions
No edit summary |
No edit summary |
||
Line 12: | Line 12: | ||
==HEX format== | ==HEX format== | ||
When requesting an items Color by executing a [[Select color (TQL)]] query, the result is returned in a HEX format, such that it can be used directly in HTML. A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal | When requesting an items Color by executing a [[Select color (TQL)]] query, the result is returned in a HEX format, such that it can be used directly in HTML. A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color. A hexadecimal number is represented by a number from 0 to 9 or by a letter A to F, where A represents the number 10 and F the number 15. Two hexadecimal numbers support 256 unique decimal numbers. | ||
[[Category:unit]] | [[Category:unit]] |
Revision as of 12:38, 16 February 2023
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).
HEX format
When requesting an items Color by executing a Select color (TQL) query, the result is returned in a HEX format, such that it can be used directly in HTML. A hexadecimal color is specified with: #RRGGBB, where the RR (red), GG (green) and BB (blue) hexadecimal integers specify the components of the color. A hexadecimal number is represented by a number from 0 to 9 or by a letter A to F, where A represents the number 10 and F the number 15. Two hexadecimal numbers support 256 unique decimal numbers.