Color

From GTA Network Wiki
Jump to navigation Jump to search

Color




dialog-warning.pngRework required!

The contents of this page are possibly invalid or incomplete. Please treat the contents of this page with caution!

If you are able to, please modify the page so that it's factually correct.


dialog-warning.png If you want the chat color system, see Fonts and Colors

Class Color from GTANetworkServer.Constant.Color.

Represents an ARGB (alpha, red, green, blue) color.

This is very similar to the Color structure from System.Drawing.

ARGB

ARGB or RGBA(Red Green Blue Alpha) is a system who described color space. It is very similar to RGB system but with an extra alpha chanel.

The alpha chanel controls the transparency. More the alpha is bigger, more your object color is opaque.


Color attributes

Attributes Type Description
alpha Int32 Gets the alpha component value of this Color structure.
red Int32 Gets the red component value of this Color structure.
green Int32 Gets the green component value of this Color structure.
blue Int32 Gets the blue component value of this Color structure.

Color Constructor(s)

Name Return Parameters Description
Color() GTANetworkServer.Constant.Color Int32 r, Int32 g, Int32 b
Color() GTANetworkServer.Constant.Color Int32 r, Int32 g, Int32 b, Int32 a

Example(s)

GTANetworkServer.Constant.Color color1 = new GTANetworkServer.Constant.Color(10,20,30);
// OR
GTANetworkServer.Constant.Color color2 = new GTANetworkServer.Constant.Color(10,20,30,100);

Using

GTANetworkServer.Constant.Color


using GTANetworkServer.Constant;

Be aware if you use System.Drawing you will have a compilation error. You must use alias like this :

using Constant = GTANetworkServer.Constant;  
...
Constant.Color colorMarker = API.GetMarkerColor(marker);

Usage example(s)

Unusing of alias declaration.


using GTANetworkServer.Constant;
...
public int[] CallBackGetMarkerColorHandle(LocalHandle marker)
{
    GTANetworkServer.Constant.Color colorMarker = API.GetMarkerColor(marker);

    int[] color = new int[4] { colorMarker.alpha, colorMarker.red, colorMarker.green, colorMarker.blue };
    return color;
}