rainbow-square
v1.0.3
Published
Create a dataURL for a square with a rainbow gradient
Downloads
44
Maintainers
Readme
rainbow-square
Create a dataURL for a square with a rainbow gradient.
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.