Service to generate avatars for users Based upon https://github.com/boringdesigners/boring-avatars

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
private val colors: List<String>

The default color palette

Functions

Link copied to clipboard

Generates a random avatar for the given id Avatar is returned as Base64 encoded SVG data url

Link copied to clipboard
private fun getBoolean(number: Int, nth: Int): Boolean

Gets whether the nth digit of a number is even

Link copied to clipboard
private fun getContrast(color: String): String

Gets the contrast color for a given color

Link copied to clipboard
private fun getDigit(number: Int, nth: Int): Int

Gets the nth digit of a number, starting from the right

Link copied to clipboard
private fun getRandomColor(number: Int, colors: List<String>, range: Int): String

Gets a random color from the provided list of colors based on the number

Link copied to clipboard
private fun getUnit(number: Int, range: Int, index: Int): Int

Generates a number required for rendering the image