Skip to content

An SVG-based identicon visual hash, generated via javascript

License

Notifications You must be signed in to change notification settings

phazei/solacon-kotlin

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

solacon for Kotlin Android

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.

Solacon.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.

About

An SVG-based identicon visual hash, generated via javascript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 100.0%