Color: Difference between revisions

From Bohemia Interactive Community
Category: Arrays
m (Some wiki formatting)
m (Some wiki formatting)
 
Line 1: Line 1:
Color is [[:Category:Arrays|a format]] of an [[Array]].
Color is [[:Category:Arrays|a format]] of an [[Array]],
namely an [[Array]] of [[Number]]s in format {{hl|[r, g, b]}} or {{hl|[r, g, b, a]}}, values ranging from 0 to 1.


== Format ==
* '''r''' is the intensity of '''{{Color|#F00|r}}'''ed,
* '''g''' is the intensity of '''{{Color|#0F0|g}}'''reen,
* '''b''' is the intensity of '''{{Color|#00F|b}}'''lue
* '''a''', if present, is '''{{Color|grey|a}}'''lpha (opacity). An alpha value of 0 means totally transparent and a value of 1 means totally opaque.


[[Array]] of [[Number]]s in format {{hl|[r, g, b]}} or {{hl|[r, g, b, a]}}, values ranging from 0 to 1.
{{Feature|informative|
 
In config, the color array respects the RGBA format, only it is encapsulated by curly braces:
* '''r''' is the intensity of '''r'''ed,
<syntaxhighlight lang="cpp">myColor[] = { 1, 1, 1, 1 };</syntaxhighlight>
* '''g''' is the intensity of '''g'''reen,
}}
* '''b''' is the intensity of '''b'''lue
* '''a''', if present, is '''a'''lpha (opacity). An alpha value of 0 means totally transparent and a value of 1 means totally opaque.


== Examples ==
== Examples ==


<sqf>
{|  class="wikitable"
[0.3, 0.3, 0.5, 1] // mauve purple
! Colour
[1, 1, 1, 1] // white
! [[SQF Syntax|SQF]] Array
[0, 0.2, 0, 1] // camo green
! HTML
[0.73, 0.24, 0.11, 1] // Rust orange
! Render
</sqf>
|-
 
| Mauve purple
The color array is encapsulated by curly braces in config:
| <sqf>[0.3, 0.3, 0.5, 1]</sqf>
<syntaxhighlight lang="cpp">myColor[] = { 1, 1, 1, 1 };</syntaxhighlight>
| <syntaxhighlight lang="html">#4D4D80</syntaxhighlight>
| style="background-color: #4D4D80" |
|-
| White
| <sqf>[1, 1, 1, 1]</sqf>
| <syntaxhighlight lang="html">#FFFFFF</syntaxhighlight>
| style="background-color: #FFF" |
|-
| Camo green
| <sqf>[0, 0.2, 0, 1]</sqf>
| <syntaxhighlight lang="html">#003300</syntaxhighlight>
| style="background-color: #030" |
|-
| Rust orange
| <sqf>[0.73, 0.24, 011, 1]</sqf>
| <syntaxhighlight lang="html">#BA3D1C</syntaxhighlight>
| style="background-color: #BA3D1C" |
|}




[[Category: Arrays]]
[[Category: Arrays]]

Latest revision as of 12:46, 22 November 2025

Color is a format of an Array, namely an Array of Numbers in format [r, g, b] or [r, g, b, a], values ranging from 0 to 1.

  • r is the intensity of red,
  • g is the intensity of green,
  • b is the intensity of blue
  • a, if present, is alpha (opacity). An alpha value of 0 means totally transparent and a value of 1 means totally opaque.
In config, the color array respects the RGBA format, only it is encapsulated by curly braces:
myColor[] = { 1, 1, 1, 1 };

Examples

Colour SQF Array HTML Render
Mauve purple
[0.3, 0.3, 0.5, 1]
#4D4D80
White
[1, 1, 1, 1]
#FFFFFF
Camo green
[0, 0.2, 0, 1]
#003300
Rust orange
[0.73, 0.24, 011, 1]
#BA3D1C