# rgba (Shared)

> Packs a colour's components into a single ARGB number, with the opacity from 0 to 1.

- **Platform**: MY Multiplayer (MYMP)
- **Kind**: Lua Function
- **Side**: Shared
- **Category**: Data and utilities
- **URL**: https://wiki.mymp.gg/en/rgba

## Syntax

```lua
int rgba(int red, int green, int blue [, float alpha = 1])
```

## Parameters

| Name | Type | Description |
| --- | --- | --- |
| `red` | `int` | The red, from 0 to 255. |
| `green` | `int` | The green, from 0 to 255. |
| `blue` | `int` | The blue, from 0 to 255. |
| `alpha` | `float` | The opacity, from 0 to 1. *(default: `1`)* |

## Returns

The colour as a number. If an argument is invalid, opaque black.

## Example

```lua
dxDrawRectangle(10, 10, 200, 40, rgba(0, 0, 0, 0.6))
```

## See also

- [tocolor (Shared)](https://wiki.mymp.gg/en/tocolor.md): Packs a colour's components into a single ARGB number. It is the same function as rgb.
- [rgb (Shared)](https://wiki.mymp.gg/en/rgb.md): Packs a colour's components into a single ARGB number. It is the same function as tocolor.
