Pixel engine
Name: pixel. Output: SVG. Generates a single-color, retro pixel-grid avatar on
an optional background.
The pixel pattern and color are derived from the hash of the seed. With symmetry enabled the grid is mirrored horizontally.
Avatar::engine('pixel')
->seed('user@example.com')
->size(256)
->pixels(5)
->symmetry(true)
->foregroundLightness(0.4)
->backgroundLightness(0.9)
->generate();
Options
| Option | Method | Type | Default |
|---|---|---|---|
| Grid size | pixels() | int | 5 |
| Horizontal symmetry | symmetry() | bool | true |
| Foreground lightness | foregroundLightness() | float | 0.5 |
| Background lightness | backgroundLightness() | float | 0.9 |
| Draw background | background() | bool | true |
pixels is the grid dimension (e.g. 5 produces a 5×5 grid). The foreground and
background share the seed's hue and differ in lightness. Set the background
toggle to false to omit the background rectangle.