# Avatar

> Derives stable, deterministic avatar colours and monogram initials from arbitrary identifying strings.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Helper](/docs/extensions/debug-core/reference/helper/index.md) › Avatar

| final class | `PHPForge\Debug\Helper\Avatar` |
| --- | --- |
| Source | [`src/Helper/Avatar.php`](https://github.com/php-forge/debug-core/blob/main/src/Helper/Avatar.php#L16) |

Derives stable, deterministic avatar colours and monogram initials from arbitrary identifying strings.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`hueFor()`](#method-hueFor) static | Returns a stable hue (`0..359`) for the given seed, or [`DEFAULT_HUE`](https://github.com/php-forge/debug-core/blob/main/src/Helper/Avatar.php#L21) when the seed is empty. | `Avatar` |
| [`initial()`](#method-initial) static | Returns the uppercased first character of the given seed, or `'?'` when the seed is empty. | `Avatar` |

## Method details

### hueFor() <span id="method-hueFor"></span>

```php
public static function hueFor(string $seed): int
```

Returns a stable hue (`0..359`) for the given seed, or [`DEFAULT_HUE`](https://github.com/php-forge/debug-core/blob/main/src/Helper/Avatar.php#L21) when the seed is empty.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$seed` | `string` | Identifying value used to derive the hue. |

**Returns**

`int`: Hue in the `0..359` range.

### initial() <span id="method-initial"></span>

```php
public static function initial(string $seed): string
```

Returns the uppercased first character of the given seed, or `'?'` when the seed is empty.

Multibyte-safe: the initial is taken as one character, not one byte.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$seed` | `string` | Identifying value the monogram is derived from. |

**Returns**

`string`: Single uppercased character, or `'?'`.