solacon

May 14, 2023 ยท View on GitHub

A solacon is a variation of an identicon, in the form of a solar/spiral/floral shape. This is also known as a "visual hash".

The solacon is seeded with a value (string) which determines the shape, symmetry, and shades of the image.

The SVG file contains all the javascript needed to generate the content, so one only needs to set attributes (e.g. data-value) on the object that is embedding the svg.

Solacon.svg

Example

Try out some dynamical examples of solacons in action.

Usage

<object type="image/svg+xml" style="width: 500px; height: 500px;" id="svg-obj"
	data="solacon.svg"
	data-value="Hello world."
	data-rgb="0, 30, 255"
></object>


// the parent document can alter the solacon
var svgObj = document.getElementById('svg-obj');
svgObj.setRGB('100, 150, 200');
svgObj.generate('some new value');
svgObj.setRGB();         // random color
svgObj.generate();       // random seed value
svgObj.setRGBFromHash(); // color is based off hashValue (default behavior)
svgObj.refresh();        // applies color change to current shape