> For the complete documentation index, see [llms.txt](https://canvacard.srgobi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://canvacard.srgobi.com/classes/welcomeleave.md).

# Welcome / Leave

### Classes

[WelcomeLeave](#WelcomeLeave)

### Functions

[setAvatar(value)](#setAvatar) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the avatar of the card

[setTitulo(value, color)](#setTitulo) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the title of the card

[setSubtitulo(value, color)](#setSubtitulo) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the subtitle of the card

[setColorCircle(value)](#setColorCircle) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the color of the circle

[setColorOverlay(value)](#setColorOverlay) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the color of the overlay

[setOpacityOverlay(value)](#setOpacityOverlay) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the opacity of the overlay

[setBackground(type, data)](#setBackground) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set background image/color of the card

[setTypeOverlay(type)](#setTypeOverlay) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the type of overlay

[build(\[font\])](#build) ⇒ `Promise.<Buffer>`

Build the card

### WelcomeLeave

**Kind**: global class<br>

#### new WelcomeLeave()

Welcome or Leave card creator

<details>

<summary>PREVIEW</summary>

\
![Welcome Card Preview 1](https://raw.githubusercontent.com/SrGobi/canvacard/refs/heads/test/welcome_1.png) ![Welcome Card Preview 2](https://raw.githubusercontent.com/SrGobi/canvacard/refs/heads/test/welcome_2.png) ![Welcome Card Preview 3](https://raw.githubusercontent.com/SrGobi/canvacard/refs/heads/test/welcome_3.png)

</details>

**Example**

```js
const welcome = new canvacard.WelcomeLeave()
  .setAvatar(data.avatarURL)
  .setBackground('COLOR', '#000000')
  .setTitulo("Titulo de la Tarjeta👋", '#FFFFFF')
  .setSubtitulo("Subtitulo de la Tarjeta 👋", '#FFFFFF')
  .setOpacityOverlay(1)
  .setColorCircle('#FFFFFF')
  .setColorOverlay('#5865F2')
  .setTypeOverlay('ROUNDED');
const welcomeImage = await welcome.build("Suravaram");
canvacard.write(welcomeImage, "./welcomer.png");
```

### setAvatar(value) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the avatar of the card

**Kind**: global function\
**Returns**: [`WelcomeLeave`](#WelcomeLeave) - The current instance of WelcomeLeave\
**Throws**:

* `APIError` Missing field: avatar

| Param | Type                 | Description          |
| ----- | -------------------- | -------------------- |
| value | `string` \| `Buffer` | Avatar URL or Buffer |

### setTitulo(value, color) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the title of the card

**Kind**: global function\
**Returns**: [`WelcomeLeave`](#WelcomeLeave) - The current instance of WelcomeLeave\
**Throws**:

* `APIError` The title must be a string

| Param | Type     | Description                |
| ----- | -------- | -------------------------- |
| value | `string` | Title value                |
| color | `string` | HTML5 color code "#000000" |

### setSubtitulo(value, color) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the subtitle of the card

**Kind**: global function\
**Returns**: [`WelcomeLeave`](#WelcomeLeave) - The current instance of WelcomeLeave\
**Throws**:

* `APIError` The subtitle must be a string

| Param | Type     | Description                |
| ----- | -------- | -------------------------- |
| value | `string` | Subtitle value             |
| color | `string` | HTML5 color code "#000000" |

### setColorCircle(value) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the color of the circle

**Kind**: global function\
**Returns**: [`WelcomeLeave`](#WelcomeLeave) - The current instance of WelcomeLeave\
**Throws**:

* `APIError` The color must be a string

| Param | Type     | Description                |
| ----- | -------- | -------------------------- |
| value | `string` | HTML5 color code "#000000" |

### setColorOverlay(value) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the color of the overlay

**Kind**: global function\
**Returns**: [`WelcomeLeave`](#WelcomeLeave) - The current instance of WelcomeLeave\
**Throws**:

* `APIError` The color must be a string

| Param | Type     | Description                |
| ----- | -------- | -------------------------- |
| value | `string` | HTML5 color code "#000000" |

### setOpacityOverlay(value) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the opacity of the overlay

**Kind**: global function\
**Returns**: [`WelcomeLeave`](#WelcomeLeave) - The current instance of WelcomeLeave\
**Throws**:

* `APIError` The opacity must be a number

| Param | Type     | Description            |
| ----- | -------- | ---------------------- |
| value | `number` | Opacity value (0 to 1) |

### setBackground(type, data) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set background image/color of the card

**Kind**: global function\
**Returns**: [`WelcomeLeave`](#WelcomeLeave) - The current instance of WelcomeLeave\
**Throws**:

* `APIError` Missing field: data

| Param | Type                   | Description                  |
| ----- | ---------------------- | ---------------------------- |
| type  | `"COLOR"` \| `"IMAGE"` | Type of background           |
| data  | `string`               | Image URL or HTML color code |

### setTypeOverlay(type) ⇒ [`WelcomeLeave`](#WelcomeLeave)

Set the type of overlay

**Kind**: global function\
**Returns**: [`WelcomeLeave`](#WelcomeLeave) - The current instance of WelcomeLeave\
**Throws**:

* `APIError` Missing field: type

| Param | Type                         | Description     |
| ----- | ---------------------------- | --------------- |
| type  | `"RECTANGLE"` \| `"ROUNDED"` | Type of overlay |

### build(\[font]) ⇒ `Promise.<Buffer>`

Build the card

**Kind**: global function\
**Returns**: `Promise.<Buffer>` - Card image in buffer format\
**Throws**:

* `APIError` Error loading background image

| Param   | Type     | Default   | Description             |
| ------- | -------- | --------- | ----------------------- |
| \[font] | `string` | `"Arial"` | Font to use in the card |
