0.1.0 • Published 5 years ago

use-avg-img v0.1.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

use-avg-img

Get the average colour of an image through the use-avg-img React hook.

Features

  • 📦 Tiny: use-avg-img weighs in at less than 2680 bytes minified and gzipped.
  • 🌳 Universal: we dist esm and cjs modules.
  • 👨‍💻 Developer friendly: Helpful development messages that are stripped away in production
  • ⌨️ Strongly typed: use-avg-img is written in TypeScript and encourages good practices this way

Installation

npm i --save use-img-avg
yarn add use-img-avg

Usage

import { useImageAverage } from '../.';
import './app.css';

const App = () => {
  const colour = useImageAverage(
    'https://images.pexels.com/photos/1798642/pexels-photo-1798642.jpeg'
  );

  console.log(colour);

  return <div>{colour.hex}</div>;
};

A full example can be seen in the examples folder

Tests

yarn
yarn test

License

MIT

0.1.0

5 years ago