Skip to main content

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

OptionMethodTypeDefault
Grid sizepixels()int5
Horizontal symmetrysymmetry()booltrue
Foreground lightnessforegroundLightness()float0.5
Background lightnessbackgroundLightness()float0.9
Draw backgroundbackground()booltrue

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.