ethereum-blockies-base64

1.0.2 • Public • Published

Ethereum Blockies Base64

A tiny library for generating blocky identicons as base64 encoded PNGs.

Sample of generated blockies

See a live demo of it in action

Install

# NPM
npm install --save ethereum-blockies-base64

# Yarn
yarn add ethereum-blockies-base64

Use

Vanilla JS

import makeBlockie from 'ethereum-blockies-base64';
 
const img = new Image() ;
img.src = makeBlockie('0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8');
 
document.body.appendChild(img);

React

import React from 'react';
import makeBlockie from 'ethereum-blockies-base64';
 
class Blockie extends React.Component {
  render() {
    return <img src={makeBlockie(this.props.address)}/>
  }
}

Note: In a real setting, we recommend saving to state and re-making the blockie on prop change for better re-render performance.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i ethereum-blockies-base64

Weekly Downloads

13,305

Version

1.0.2

License

MIT

Unpacked Size

16.6 kB

Total Files

6

Last publish

Collaborators

  • mycrypto-admin