solacon for Kotlin Android
May 13, 2023 ยท View on GitHub
Full credit to naknomum who created the original JS version. I just converted it to java with a little AI assistance.
solacon
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.

Example
Original javascript demo: Try out some dynamical examples of solacons in action.
Java implementation looks identical
Usage
val solaconGenerator = Solacon()
solacon = view.findViewById(R.id.solacon)
solacon.setOnClickListener { view ->
val hash = java.util.UUID.randomUUID().toString()
val size = 512 // desired size of the identicon in pixels
//3rd parameter is an optional color, must be formatted: "#XXXXXX"
val solaconBitmap = solaconGenerator.generateBitmap(hash, size)
solacon.setImageBitmap(solaconBitmap)
}
solacon.performClick()
Similar projects
For related work, check out Awesome Identicons, a curated list of visual hashes maintained by Husam ABBOUD.