color-loader
Advanced tools
Comparing version 2.1.2 to 2.1.3
{ | ||
"name": "color-loader", | ||
"version": "2.1.2", | ||
"version": "2.1.3", | ||
"description": "Image color palette loader for webpack", | ||
@@ -22,2 +22,5 @@ "main": "loader.js", | ||
}, | ||
"jest": { | ||
"testEnvironment": "node" | ||
}, | ||
"peerDependencies": { | ||
@@ -32,9 +35,9 @@ "file-loader": "^1.1.5" | ||
"devDependencies": { | ||
"eslint": "^4.12.0", | ||
"eslint-config-knoword": "^5.5.0", | ||
"file-loader": "^1.1.5", | ||
"jest": "^21.2.1", | ||
"@knoword/eslint-config": "^6.12.0", | ||
"eslint": "^5.2.0", | ||
"file-loader": "^1.1.11", | ||
"jest": "^23.4.1", | ||
"memory-fs": "^0.4.1", | ||
"webpack": "^3.8.1" | ||
"webpack": "^4.16.2" | ||
} | ||
} |
# color-loader | ||
[![CircleCI](https://circleci.com/gh/trevorblades/color-loader.svg?style=shield&circle-token=27c58abd14ac02f3fa39792e5aa883befc54655d)](https://circleci.com/gh/trevorblades/color-loader) | ||
[![CircleCI](https://circleci.com/gh/trevorblades/color-loader.svg?style=shield)](https://circleci.com/gh/trevorblades/color-loader) | ||
@@ -9,9 +9,11 @@ A webpack loader that extracts the color palette for an image | ||
`npm install --save file-loader color-loader` | ||
```shell | ||
$ npm install --save-dev color-loader file-loader | ||
``` | ||
`color-loader` has a peer dependency on `file-loader`, so we'll need to make sure we have that installed. | ||
This loader depends on [`file-loader`](https://github.com/webpack-contrib/file-loader), so be sure to install that too if you don't have it already. | ||
## Usage | ||
This loader is designed to be a drop-in replacement for `file-loader`. It will output the path to the provided image, along with information about the colors in the image. It features support for JPEG, PNG, GIF, and SVG files. | ||
This loader supports JPEG, PNG, GIF, and SVG files and is designed to be a drop-in replacement for `file-loader`, in case you're already using that. The loader will output the path to the provided image file, along with information about the colors in the image. | ||
@@ -22,5 +24,5 @@ ```js | ||
- **`image`** is the image path generated by the file loader | ||
- **`color`** is the most dominant color in the image | ||
- **`colors`** is an array of the dominant colors in the image | ||
- `image` is the image path generated by the file loader | ||
- `color` is the most dominant color in the image | ||
- `colors` is an array of the dominant colors in the image | ||
@@ -45,3 +47,3 @@ You can use it in your webpack configuration, too! This means that all images that you `import` or `require` will always return the colors extracted from the image. | ||
`color-loader` takes no options, however because it implements `file-loader`, you can pass along any options you would normally pass to that loader. More information about `file-loader` [here](https://github.com/webpack-contrib/file-loader). | ||
You can pass along any options you would normally pass to [`file-loader`](https://github.com/webpack-contrib/file-loader). | ||
@@ -52,3 +54,3 @@ ## Example | ||
![example image](https://raw.githubusercontent.com/trevorblades/color-loader/master/test/example.png) | ||
![example image](https://raw.githubusercontent.com/trevorblades/color-loader/master/example.png) | ||
@@ -68,9 +70,15 @@ Will result in these colors: | ||
const Component = () => ( | ||
<div style={{ | ||
backgroundColor: color, // #3a4f25 | ||
backgroundImage: image | ||
}}> | ||
<h1>Hello world!</h1> | ||
<div | ||
style={{ | ||
backgroundColor: color, // #3a4f25 | ||
backgroundImage: image | ||
}} | ||
> | ||
<h1>They ate the Pokémon...</h1> | ||
</div> | ||
); | ||
``` | ||
And it might look something like this (results may vary): | ||
![example gif](https://raw.githubusercontent.com/trevorblades/color-loader/master/example.gif) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1222951
9
80