rainbow-square
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

rainbow-square

Create a dataURL for a square with a rainbow gradient.

GitHub release Build Status codecov Codacy Badge

rainbow-square

Install

You can install via npm or yarn.

npm

npm install --save rainbow-square

yarn

yarn add rainbow-square

Documentation

This documentation is written in TypeScript, however this library works fine in vanilla JavaScript too.

Usage

The async function will return a dataURL which can be used in the src attribute of an img tag.

import { rainbowSquare } from 'rainbow-square';

async function myFn(): Promise<void> {
  const image = document.createElement('img');

  img.src = await rainbowSquare(256);

  document.body.appendChild(img);
}

void myFn();

You can also provide a height if you want to generate an rainbow gradient that isn't a square.

Package Sidebar

Install

npm i rainbow-square

Weekly Downloads

24

Version

1.0.3

License

MIT

Unpacked Size

8.68 kB

Total Files

9

Last publish

Collaborators

  • bameyrick