Socket
Socket
Sign inDemoInstall

ethereum-gradient-base64

Package Overview
Dependencies
1
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    ethereum-gradient-base64

A tiny library for generating base64 encoded PNG gradient identicons.


Version published
Weekly downloads
91
increased by37.88%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Ethereum Gradient Base64

A tiny library for generating gradient identicons as base64 encoded SVGs.

Sample of generated gradients

See a live demo of it in action

Install

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

# Yarn
yarn add ethereum-gradient-base64

Use

Vanilla JS

import {makeGradient} from 'ethereum-gradient-base64';
// you can use makeGradientStatic for a gradient that does not move. Is not animated.

const img = new Image() ;
img.src = makeGradient('0x7cB57B5A97eAbe94205C07890BE4c1aD31E486A8');

document.body.appendChild(img);

React

import React from 'react';
import {makeGradient} from 'ethereum-gradient-base64';
// you can use makeGradientStatic for a gradient that does not move. Is not animated.

class Gradient extends React.Component {
  render() {
    return <img src={makeGradient(this.props.address)}/>
  }
}

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

License

MIT

FAQs

Last updated on 08 Dec 2022

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc