Color: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(color cannot have 5 elements)
m (Some wiki formatting)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
'''Format:'''
Color is [[:Category:Arrays|a format]] of an [[Array]].


[r, g, b, a]
== Format ==


'''Description:'''
[[Array]] of [[Number]]s in format {{hl|[r, g, b]}} or {{hl|[r, g, b, a]}}, values ranging from 0 to 1.


Color - r is the intensity of red, g is the intensity of green, b is the intensity of blue.
* '''r''' is the intensity of '''r'''ed,
* '''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.


a is alpha (opacity). An alpha value of 0 means totally transparent and a value of 1 means totally opaque.
== Examples ==


All values range from 0 to 1.
<sqf>
[0.3, 0.3, 0.5, 1] // mauve purple
[1, 1, 1, 1] // white
[0, 0.2, 0, 1] // camo green
[0.73, 0.24, 0.11, 1] // Rust orange
</sqf>


Here are a few colors to start you off:
The color array is encapsulated by curly braces in config:
<syntaxhighlight lang="cpp">myColor[] = { 1, 1, 1, 1 };</syntaxhighlight>


[0.3,0.3,0.5,1]; // mauve purple
[1,1,1,1] // white
[0,0.2,0,1] // camo green
[0.73,0.24,0.11,1] // Rust orange


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

Latest revision as of 14:09, 15 July 2022

Color is a format of an Array.

Format

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.

Examples

[0.3, 0.3, 0.5, 1] // mauve purple [1, 1, 1, 1] // white [0, 0.2, 0, 1] // camo green [0.73, 0.24, 0.11, 1] // Rust orange

The color array is encapsulated by curly braces in config:

myColor[] = { 1, 1, 1, 1 };