TachiSnap
TachiSnap — Pixel Snapper for animation pixel artists. Rust + WebAssembly client-side tool for cleaning up AI-generated…
Radiance is a modern PHP library designed to generate beautiful, deterministic mesh gradient avatars from any string. S…
Beautifully deterministic avatars for PHP
Radiance is a modern PHP library designed to generate beautiful, deterministic mesh gradient avatars from any string. Same input always produces the same unique avatar, making it perfect for user profiles, identicons and more.
👉 Try the interactive playground
Requires PHP 8.2+.
Install Radiance via Composer:
composer require tomloprod/radiance
Generate a simple avatar from a seed:
$svg = radiance()
->seed('tomloprod')
->text('TL')
->toSvg();
Radiance provides a fluent API to fully customize your avatars:
$svg = radiance()
->seed('tomloprod')
->text('TL')
->size(256)
->squircle()
->baseColor('#3498db')
->saturation(1.5)
->contrast(1.2)
->toSvg();
Add a identicon-like pixelated overlay:
$svg = radiance()
->seed('tomloprod')
->enablePixelPattern()
->pixelGridSize(8)
->pixelOpacity(0.4)
->pixelDensity(0.5)
->pixelShapeCircles()
->pixelColorAccent()
->toSvg();
Fine-tune how text is displayed:
$svg = radiance()
->seed('tomloprod')
->text('TL')
->fontFamily('Inter')
->fontSizeRatio(0.45)
->fontSizeRatioAuto(false)
->textShadow(0.8)
->toSvg();
| Method | Description | Default |
|---|---|---|
seed(string $seed) |
Set the deterministic seed. | null (random) |
| Method | Description | Default |
|---|---|---|
size(int $size) |
Set the dimension in pixels (width/height). | 512 |
circle() |
Set the shape to Circle. | - |
square() |
Set the shape to Square. | (Square) |
squircle() |
Set the shape to Squircle (rounded). | - |
| Method | Description | Default |
|---|---|---|
baseColor(string $color) |
Influence the generated palette hue. Accepts hex, rgb, or hsl. | null |
solidColor(string $color) |
Use a fixed background instead of gradient. | null |
| Method | Description | Default |
|---|---|---|
saturation(float $val) |
Adjust gradient saturation. 1.0 = original, >1 = vivid, <1 = muted. | 1.0 |
contrast(float $val) |
Adjust gradient contrast. 1.0 = original, >1 = higher contrast. | 1.0 |
fadeDistance(int $val) |
Control gradient circle size (40-200). Lower = colors more separated. | 50 |
| Method | Description | Default |
|---|---|---|
text(string $text) |
Add a centered text overlay. | null |
fontFamily(string $font) |
Set the font-family for the text. | monospace |
fontSizeRatio(float $ratio) |
Set font size as ratio of avatar size (0.01-1.0). Disables auto-sizing. | 0.5 |
fontSizeRatioAuto(bool $enabled) |
Enable/disable automatic font sizing based on text length. | true |
fontWeight(int $fontWeight) |
Set the weight of the used font. | 600 |
textShadow(float $val) |
Set text shadow intensity. 0 = no shadow. | 1.0 |
| Method | Description | Default |
|---|---|---|
enablePixelPattern(bool $enable) |
Enable/disable the identicon-style overlay. | true |
pixelGridSize(int $size) |
Set the pixel grid size (3, 5, 7...). Must be odd for symmetry. | 13 |
pixelOpacity(float $opacity) |
Set pixel pattern opacity (0.0-1.0). | 0.3 |
pixelDensity(float $density) |
Control how many pixels are drawn (0.0-1.0). | 0.25 |
pixelColorGradient() |
Use gradient-derived colors for pixels. | (Gradient) |
pixelColorMonochrome() |
Use white color for all pixels. | - |
pixelColorAccent() |
Use complementary accent color for pixels. | - |
pixelShapeSquares() |
Use square shapes for pixels. | (Squares) |
pixelShapeCircles() |
Use circle shapes for pixels. | - |
pixelShapeMix() |
Use mixed shapes (deterministic per seed). | - |
| Method | Description |
|---|---|
toSvg() |
Get the avatar as an SVG string. |
toBase64() |
Get the avatar as a Base64 encoded data URI. |
Contributions are welcome! Please review the Contributing Guidelines before submitting a pull request.
git checkout -b feature/amazing-feature).git commit -m 'Add some feature').git push origin feature/amazing-feature).Radiance is open-sourced software licensed under the MIT license.
Created by Tomás López • Powered by Coloritymore like this
TachiSnap — Pixel Snapper for animation pixel artists. Rust + WebAssembly client-side tool for cleaning up AI-generated…
search projects, people, and tags