@digitalungdom/bot-identicon
Bot Identicon
A React component that deterministically generates robot icons based on the given input. See example code below.
Made with create-react-library
Install
npm install --save @digitalungdom/bot-identicon
Usage
import React, { Component } from 'react'
import HashedBotIdenticon from '@digitalungdom/bot-identicon'
class Example extends Component {
render() {
return <HashedBotIdenticon identifier='john von neumann' size={500} />
}
}
Props
BaseBotIdenticonProps
Name | Type | Default | Description |
---|---|---|---|
size |
'inherit' | number |
200 |
size of the icon |
background |
boolean |
false |
display background |
BotIdenticonProps
Inherits BaseBotIdenticonProps.
Name | Type | Default | Description |
---|---|---|---|
color |
[h: number, s: number, l: number] |
[216, 81, 51] |
color in HSL-values |
face |
Face |
normal |
face of the identicon |
<HashedBotIdenticon>
Inherits props for BotIdenticonProps
. To override the hashed values, one can provide a face
and/or color
property.
-
identifier
- string that will deterministically create colors and a face with md5
Face
One of the following values
'cool'
'evil'
'kiss'
'incognito'
'normal'
'laughing'
'happyEyes'
'heartEyes'
'celebrate'
Dependencies
Crypto-js is needed to hash the identifier.
Credit
The original robot design is by @charlesmaddock and @digitalungdom-se. The code for this repo was originally developed by @adelhult. The transitition to TypeScript and publishing as a reusable component was made by @nautman.
License
MIT © digitalungdom-se