Avatar
API reference › Debug Core › Helper › Avatar
Derives stable, deterministic avatar colours and monogram initials from arbitrary identifying strings.
Methods
Section titled “Methods”| Method | Description | Defined by |
|---|---|---|
hueFor() static | Returns a stable hue (0..359) for the given seed, or DEFAULT_HUE when the seed is empty. | Avatar |
initial() static | Returns the uppercased first character of the given seed, or '?' when the seed is empty. | Avatar |
Method details
Section titled “Method details”hueFor()
Section titled “hueFor() ”public static function hueFor(string $seed): intReturns a stable hue (0..359) for the given seed, or DEFAULT_HUE 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()
Section titled “initial() ”public static function initial(string $seed): stringReturns 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 '?'.