1.1.1 • Published 1 year ago

react-color-surge v1.1.1

Weekly downloads
-
License
-
Repository
github
Last release
1 year ago

react-color-surge

react-color-surge is a lightweight package that allows you to easily extract the dominant color from an image using a React hook.

Installation

You can install the package using npm:

npm install react-color-surge 

Usage

Color function

The Color function takes two parameters:

  • [...img]: a set of normal img tag parameters (such as src, alt, etc.).
  • hook: a React hook function that will be used to retrieve the dominant color from the passed image.

Here's an example usage of the Color function:

import { Color } from 'react-color-surge/dist/index';

function App() {
  const [color, setColor] = useState('#FFFFFF');

  return (
    <div>
      <Color
        src ={require('/path/to/image.jpg')) alt: 'Example image',
        hook={setColor}
      />
      <div style={{ backgroundColor: color }}>
        This is an example div with the extracted dominant color.
      </div>
    </div>
  );
}
1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago

0.1.13

1 year ago

0.1.12

1 year ago

0.1.11

1 year ago

0.1.10

1 year ago

0.1.9

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago